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
8 9 10 11 |
# File 'lib/conduit/util.rb', line 8 def self.find_driver(*args) find_driver!(*args) rescue NameError end |
.find_driver!(*args) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/conduit/util.rb', line 13 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, end |