logo
  • 教程列表
  • SO官方文檔
  • 載入原始檔
    • 要求檔案只載入一次
    • 自動載入原始檔
    • 載入可選檔案
    • 重複載入檔案
    • 載入幾個檔案
  1. StackOverflow 文件
  2. Ruby Language 教程
  3. 載入原始檔
  4. 載入幾個檔案

載入幾個檔案

Created: November-22, 2018

你可以使用任何 ruby 技術動態建立要載入的檔案列表。Globing 的例證為以 test 開頭的檔案,按字母順序裝載。

Dir[ "#{ __dir__ }**/test*.rb" ) ].sort.each do |source|

    require_relative source

end
  • 重複載入檔案

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明