Class: CollectionJson::Serializer::Objects::Template
- Inherits:
-
Object
- Object
- CollectionJson::Serializer::Objects::Template
- Defined in:
- lib/collection_json_serializer/objects/template.rb
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(serializer) ⇒ Template
constructor
A new instance of Template.
Constructor Details
#initialize(serializer) ⇒ Template
Returns a new instance of Template.
5 6 7 8 |
# File 'lib/collection_json_serializer/objects/template.rb', line 5 def initialize(serializer) @serializer = serializer @data = Array.new end |
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/collection_json_serializer/objects/template.rb', line 10 def create @serializer.template.each do |attr| params = attr.extract_params c = { name: params[:name], value: nil.to_s } c.merge!(params[:properties]) if params[:properties] @data << c end if @serializer.template.present? @data end |