Class: CollectionJSON::TemplateBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/collection-json/builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject (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