Module: Toy::Extensions::Array

Defined in:
lib/toy/dynamo/extensions/array.rb

Instance Method Summary collapse

Instance Method Details

#from_store(value) ⇒ Object



9
10
11
# File 'lib/toy/dynamo/extensions/array.rb', line 9

def from_store(value, *)
  value.nil? ? store_default : (value.class.is_a?(Array) ? value : Marshal.load(value))
end

#to_store(value) ⇒ Object



4
5
6
7
# File 'lib/toy/dynamo/extensions/array.rb', line 4

def to_store(value, *)
  value = value.respond_to?(:lines) ? value.lines : value
  AWS::DynamoDB::Binary.new(Marshal.dump(value.to_a))
end