module Toy::Extensions::Hash

Public Instance Methods

from_store(value, *) click to toggle source
# 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, *) click to toggle source
# File lib/toy/dynamo/extensions/hash.rb, line 4
def to_store(value, *)
  AWS::DynamoDB::Binary.new(Marshal.dump(value))
end