Class: Hat::Sideloading::JsonDeserializer
- Inherits:
-
Object
- Object
- Hat::Sideloading::JsonDeserializer
- Defined in:
- lib/hat/sideloading/json_deserializer.rb
Instance Method Summary collapse
- #deserialize ⇒ Object
-
#initialize(json) ⇒ JsonDeserializer
constructor
A new instance of JsonDeserializer.
Constructor Details
#initialize(json) ⇒ JsonDeserializer
Returns a new instance of JsonDeserializer.
14 15 16 17 18 19 20 |
# File 'lib/hat/sideloading/json_deserializer.rb', line 14 def initialize(json) @json = json @root_key = json['meta']['root_key'].to_s @identity_map = IdentityMap.new @sideload_map = SideloadMap.new(json, root_key) @key_to_class_mappings = {} end |
Instance Method Details
#deserialize ⇒ Object
22 23 24 25 26 |
# File 'lib/hat/sideloading/json_deserializer.rb', line 22 def deserialize json[root_key].map do |json_item| create_from_json_item(target_class_for_key(root_key), json_item) end end |