Module: Conduit::Driver
- Defined in:
- lib/conduit.rb
Class Method Summary collapse
-
.index ⇒ Object
Store a list of available drivers.
-
.load_drivers ⇒ Object
Load the drivers automatically, but only when they’re needed.
Class Method Details
.index ⇒ Object
Store a list of available drivers
e.g. Conduit::Driver.index
> [:foo, :bar, :baz]
39 40 41 |
# File 'lib/conduit.rb', line 39 def index @index ||= [] end |
.load_drivers ⇒ Object
Load the drivers automatically, but only when they’re needed
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/conduit.rb', line 45 def load_drivers Conduit.configuration.driver_paths.each do |dir| raise "Directory not found: #{dir}" unless File.exist?(dir) Dir["#{dir}/**/driver.rb"].each do |file| raise "File not found: #{file}" unless File.exist?(file) name = File.dirname(file).split(File::SEPARATOR).last.classify.to_sym index << name.downcase autoload name, file end end end |