Class: Aws::DynamoDB::AttributeValue::Unmarshaler Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-core/dynamodb/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.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/aws-sdk-core/dynamodb/attribute_value.rb', line 70

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.new(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.new(n) })
  when :bs then Set.new(value.map { |b| StringIO.new(b) })
  when :es then Set.new
  else
    raise ArgumentError, "unhandled type #{type.inspect}"
  end
end