Sha256: 04939f19bf53afae7a7eb953e7c034b0c5ecdc2934537b4140c0e061b95a8cef
Contents?: true
Size: 753 Bytes
Versions: 1
Compression:
Stored size: 753 Bytes
Contents
# # collection.rb # Crowdskout # # Copyright (c) 2016 Kyle Schutt. All rights reserved. module Crowdskout module Components class Collection < Component attr_accessor :key_name, :items # Factory method to create an Collection object from a json string # @param [String] key_name - name of the collection # @param [Array] items - properties to create object from # @return [Collection] def self.create(key_name, items) obj = Collection.new obj.key_name = key_name obj.items = [] if items items.each do |item| # item is a hash of fields obj.items << Components::Item.create(item) end end obj end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
crowdskout-0.0.5 | lib/crowdskout/components/profiles/collection.rb |