Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Includes:
- FIRM::Serializable::JSON::ContainerPatch
- Defined in:
- lib/firm/serializer/json.rb
Direct Known Subclasses
Class Method Summary collapse
-
.json_create(object) ⇒ Hash
Create a new Hash instance from deserialized JSON data.
Instance Method Summary collapse
Methods included from FIRM::Serializable::JSON::ContainerPatch
Class Method Details
.json_create(object) ⇒ Hash
Create a new Hash instance from deserialized JSON data.
371 372 373 |
# File 'lib/firm/serializer/json.rb', line 371 def json_create(object) json_new(object) { |instance| instance.replace(object['data'].to_h) } end |
Instance Method Details
#as_json ⇒ Object
376 377 378 379 380 |
# File 'lib/firm/serializer/json.rb', line 376 def as_json(*) build_json do |json_data| json_data['data'] = collect { |k,v| [k.respond_to?(:as_json) ? k.as_json : k, v.respond_to?(:as_json) ? v.as_json : v] } end end |