Method: CollectionJSON::Attribute.from_hash

Defined in:
lib/collection-json/attribute.rb

.from_hash(hash) ⇒ Object



38
39
40
41
42
# File 'lib/collection-json/attribute.rb', line 38

def self.from_hash(hash)
  self.new.tap do |item|
    hash.each { |k,v| item.send(k, v) if item.respond_to?(k) }
  end
end