Module: Dynamoid::Undumping
- Defined in:
- lib/dynamoid/undumping.rb
Defined Under Namespace
Modules: UndumpHashHelper
Classes: ArrayUndumper, Base, BinaryUndumper, BooleanUndumper, CustomTypeUndumper, DateTimeUndumper, DateUndumper, IntegerUndumper, MapUndumper, NumberUndumper, RawUndumper, SerializedUndumper, SetUndumper, StringUndumper
Class Method Summary
collapse
Class Method Details
.find_undumper(options) ⇒ Object
.undump_attributes(attributes, attributes_options) ⇒ Object
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/dynamoid/undumping.rb', line 6
def self.undump_attributes(attributes, attributes_options)
{}.tap do |h|
attributes.symbolize_keys
.select { |attribute| attributes_options.key?(attribute) }
.each do |attribute, value|
h[attribute] = undump_field(value, attributes_options[attribute])
end
end
end
|
.undump_field(value, options) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/dynamoid/undumping.rb', line 17
def self.undump_field(value, options)
return nil if value.nil?
undumper = find_undumper(options)
if undumper.nil?
raise ArgumentError, "Unknown type #{options[:type]}"
end
undumper.process(value)
end
|