Class: Dynamoid::Undumping::DateTimeUndumper

Inherits:
Base
  • Object
show all
Defined in:
lib/dynamoid/undumping.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Dynamoid::Undumping::Base

Instance Method Details

#process(value) ⇒ Object



199
200
201
202
203
204
205
206
207
208
209
# File 'lib/dynamoid/undumping.rb', line 199

def process(value)
  return value if value.is_a?(Date) || value.is_a?(DateTime) || value.is_a?(Time)

  use_string_format = if @options[:store_as_string].nil?
                        Dynamoid.config.store_datetime_as_string
                      else
                        @options[:store_as_string]
                      end
  value = DateTime.iso8601(value).to_time.to_i if use_string_format
  ApplicationTimeZone.at(value)
end