Module: Toy::Extensions::Hash
- Defined in:
- lib/toy/dynamo/extensions/hash.rb
Instance Method Summary collapse
Instance Method Details
#from_store(value) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/toy/dynamo/extensions/hash.rb', line 8 def from_store(value, *) #begin value.nil? ? store_default : (value.class.is_a?(Hash) ? value : Marshal.load(value)) #rescue ArgumentError => e #if e.message =~ /dump format error/ #Toy::Dynamo::Config.logger.error "Could not unmarshal data!\n\t#{value.inspect}" #store_default #end #end end |
#to_store(value) ⇒ Object
4 5 6 |
# File 'lib/toy/dynamo/extensions/hash.rb', line 4 def to_store(value, *) AWS::DynamoDB::Binary.new(Marshal.dump(value)) end |