Module: Hari::Entity::Serialization::ClassMethods
- Defined in:
- lib/hari/entity/serialization.rb
Instance Method Summary collapse
Instance Method Details
#from_json(source) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/hari/entity/serialization.rb', line 24 def from_json(source) return if source.blank? attrs = Yajl::Parser.parse(source).inject({}) do |buffer, (key, value)| if prop = properties.find { |p| p.name == key } buffer[key] = prop.desserialize(value) end buffer end new attrs end |