Module: Conduit::Util
- Defined in:
- lib/conduit/util.rb
Class Method Summary collapse
-
.find_driver(*args) ⇒ Object
Instantiate the action class with options.
- .find_driver!(*args) ⇒ Object
Class Method Details
.find_driver(*args) ⇒ Object
Instantiate the action class with options
returns:
> Conduit::Driver::Fusion::Purchase
9 10 11 12 |
# File 'lib/conduit/util.rb', line 9 def self.find_driver(*args) find_driver!(*args) rescue NameError end |
.find_driver!(*args) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/conduit/util.rb', line 14 def self.find_driver!(*args) driver = args.map(&:to_s).map(&:camelize).join('::') Conduit::Driver.const_get(driver) rescue NameError => error = "Unable to find driver with arguments: #{args.join ','}. " + "Expected #{error.name} to be implemented" raise NameError.new() end |