Module: PigeonHole::JSONHash
- Defined in:
- lib/pigeon_hole/json_hash.rb
Constant Summary collapse
- TYPE_VALUE =
'hash'.freeze
Class Method Summary collapse
Class Method Details
.deserialize(hash) ⇒ Object
16 17 18 |
# File 'lib/pigeon_hole/json_hash.rb', line 16 def self.deserialize(hash) Hash[hash['v']] end |
.serialize(hash) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/pigeon_hole/json_hash.rb', line 5 def self.serialize(hash) if hash.empty? {} else { TypedJSON::TYPE_KEY => TYPE_VALUE, 'v' => hash.to_a } end end |