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.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(controller = nil, options = {}) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(controller = nil, options = {}) ⇒ Builder
Returns a new instance of Builder.
6 7 8 9 |
# File 'lib/client_data/builder.rb', line 6 def initialize(controller = nil, = {}) @controller = controller @options = 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 |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/client_data/builder.rb', line 4 def @options end |
Class Method Details
.builder_name ⇒ Object
27 28 29 |
# File 'lib/client_data/builder.rb', line 27 def self.builder_name self.name.split('::').last.chomp('Builder').underscore end |
.properties(*props) ⇒ Object
11 12 13 14 15 |
# File 'lib/client_data/builder.rb', line 11 def self.properties(*props) props.each do |m| property(m) end end |
.property(prop) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/client_data/builder.rb', line 17 def self.property(prop) define_method(prop) do if controller.respond_to?(prop, true) controller.send(prop) else controller.instance_variable_get(:"@#{prop}") end end end |