Class: CollectionJSON::TemplateBuilder
- Inherits:
-
Object
- Object
- CollectionJSON::TemplateBuilder
- Defined in:
- lib/collection-json/builder.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #add_data(name, params = {}) ⇒ Object
-
#initialize(data) ⇒ TemplateBuilder
constructor
A new instance of TemplateBuilder.
Constructor Details
#initialize(data) ⇒ TemplateBuilder
Returns a new instance of TemplateBuilder.
86 87 88 |
# File 'lib/collection-json/builder.rb', line 86 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
84 85 86 |
# File 'lib/collection-json/builder.rb', line 84 def data @data end |
Instance Method Details
#add_data(name, params = {}) ⇒ Object
90 91 92 93 |
# File 'lib/collection-json/builder.rb', line 90 def add_data(name, params = {}) params.merge!({'name' => name}) data << params end |