Class: ClientData::Builder
- Inherits:
-
Object
- Object
- ClientData::Builder
- Defined in:
- lib/client_data/builder.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
Returns the value of attribute controller.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(controller = nil) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(controller = nil) ⇒ Builder
5 6 7 |
# File 'lib/client_data/builder.rb', line 5 def initialize(controller = nil) @controller = controller end |
Instance Attribute Details
#controller ⇒ Object
Returns the value of attribute controller.
3 4 5 |
# File 'lib/client_data/builder.rb', line 3 def controller @controller end |
Class Method Details
.properties(*props) ⇒ Object
9 10 11 12 13 |
# File 'lib/client_data/builder.rb', line 9 def self.properties(*props) props.each do |m| property(m) end end |
.property(prop) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/client_data/builder.rb', line 15 def self.property(prop) define_method(prop) do if controller.respond_to?(prop) controller.send(prop) else controller.instance_variable_get(:"@#{prop}") end end end |