Class: Aws::DynamoDBStreams::AttributeValue::Unmarshaler Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-dynamodbstreams/attribute_value.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#format(obj) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/aws-sdk-dynamodbstreams/attribute_value.rb', line 22

def format(obj)
  type, value = extract_type_and_value(obj)
  case type
  when :m
    value.each.with_object({}) do |(k, v), map|
      map[k] = format(v)
    end
  when :l then value.map { |v| format(v) }
  when :s then value
  when :n then BigDecimal(value)
  when :b then StringIO.new(value)
  when :null then nil
  when :bool then value
  when :ss then Set.new(value)
  when :ns then Set.new(value.map { |n| BigDecimal(n) })
  when :bs then Set.new(value.map { |b| StringIO.new(b) })
  else
    raise ArgumentError, "unhandled type #{type.inspect}"
  end
end