Class: Dynamoid::Undumping::DateUndumper

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


213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/dynamoid/undumping.rb', line 213

def process(value)
  use_string_format = if @options[:store_as_string].nil?
                        Dynamoid.config.store_date_as_string
                      else
                        @options[:store_as_string]
                      end

  if use_string_format
    Date.iso8601(value)
  else
    Dynamoid::Persistence::UNIX_EPOCH_DATE + value.to_i
  end
end