您好,欢迎来到二三四教育网。
搜索
您的当前位置:首页requier 引用一个文件夹下的多个文件

requier 引用一个文件夹下的多个文件

来源:二三四教育网
gem 'require_all'

And then execute:bundle

Usagerequire

 'require_all'
*load all ruby files in the directory "lib" and its subdirectories*
require_all 'lib'
*or load all files by using glob*
require_all 'lib/**/*.rb'
*or load files in an Array*
require_all Dir.glob("blah/**/*.rb").reject { |f| stupid_file? f }
*or load manually specified files*
require_all 'lib/a.rb', 'lib/b.rb', 'lib/c.rb', 'lib/d.rb'

You can also load files relative to the current file by using require_rel:
Instead of

require File.dirname(__FILE__) + '/foobar'

you can do simply like thisrequire_rel 'foobar'

Copyright © 2019- how234.cn 版权所有 赣ICP备2023008801号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务