Method: Loadable::VendorLoader#initialize
- Defined in:
- lib/loadable/loaders/vendor_loader.rb
#initialize(*directory) ⇒ VendorLoader
Returns a new instance of VendorLoader.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/loadable/loaders/vendor_loader.rb', line 21 def initialize(*directory) raise ArgumentError if directory.empty? @_yaml_loaded ||= !(require 'yaml').nil? settings = (Hash === directory.last ? directory.pop : {}) directory = File.(File.join(*directory)) @load_path = [] if settings[:direct] @load_path.concat(Dir.glob(directory)) else Dir.glob(directory).each do |dir| next unless File.directory?(dir) build_loadpath(dir) end end if @load_path.empty? # TODO: if load_path empty should we fallback to direct path ? end end |