Class: Driver::Client
- Inherits:
-
Object
- Object
- Driver::Client
- Defined in:
- lib/driver/client.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(api) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(api) ⇒ Client
Returns a new instance of Client.
35 36 37 |
# File 'lib/driver/client.rb', line 35 def initialize(api) @api = api end |
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
33 34 35 |
# File 'lib/driver/client.rb', line 33 def api @api end |
Class Method Details
.const_missing(name) ⇒ Object
4 5 6 |
# File 'lib/driver/client.rb', line 4 def const_missing(name) name end |
.drive(*modules) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/driver/client.rb', line 8 def drive(*modules) # api autoload :API, "#{self}/api".underscore modules.each_with_index do |m, i| # client autoload m, "#{self}::#{m}".underscore modules[i] = "#{self}::#{m}".constantize end include *modules end |
.model(*modules) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/driver/client.rb', line 22 def model(*modules) modules.each_with_index do |m, i| # model module_name = self.to_s.sub("::#{self.to_s.demodulize}", '').constantize module_name.autoload m, "#{self}::Model::#{m}".underscore end Driver::Model.concerns end |