lib/crowdskout/components/profiles/collection.rb in crowdskout-0.0.9 vs lib/crowdskout/components/profiles/collection.rb in crowdskout-0.0.10
- old
+ new
@@ -16,11 +16,15 @@
def self.create(props)
obj = Collection.new
obj.items = []
props.each do |key, value|
obj.key_name = key
- value.each do |collection|
- obj.items << Components::Item.create(collection)
+ if value.is_a?(Hash) || value.is_a?(Array)
+ value.each do |collection|
+ obj.items << Components::Item.create(collection)
+ end
+ else
+ obj.items << Components::Item.create({ key => value })
end
end
obj
end
\ No newline at end of file