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.
368 369 370 |
# File 'lib/firm/serializer/json.rb', line 368 def json_create(object) json_new(object) { |instance| instance.replace(object['data'].to_h) } end |
Instance Method Details
#as_json ⇒ Object
373 374 375 376 377 |
# File 'lib/firm/serializer/json.rb', line 373 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 |