Sha256: 456882b6a6e760263b80a782b9132cea8de685d7020d061a810178bf15a564b4

Contents?: true

Size: 216 Bytes

Versions: 17

Compression:

Stored size: 216 Bytes

Contents

class Timestamp
  def self.from_mongo(value)
    if value.nil? || value == ''
      nil
    else
      Time.zone.at(value.to_i)
    end
  end

  def self.to_mongo(value)
    value.to_i
  end
end

Time.zone ||= 'UTC'

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
mongomapper_ext-0.5.2 lib/mongomapper_ext/types/timestamp.rb
mongomapper_ext-0.5.1 lib/mongomapper_ext/types/timestamp.rb
mongomapper_ext-0.5.0 lib/mongomapper_ext/types/timestamp.rb
mongomapper_ext-0.4.0 lib/mongomapper_ext/types/timestamp.rb
mongomapper_ext-0.3.0 lib/mongomapper_ext/types/timestamp.rb
mongomapper_ext-0.2.4 lib/mongomapper_ext/types/timestamp.rb
mongomapper_ext-0.2.3 lib/mongomapper_ext/types/timestamp.rb
mongomapper_ext-0.2.2 lib/mongomapper_ext/types/timestamp.rb
mongomapper_ext-0.2.1 lib/mongomapper_ext/types/timestamp.rb
mongomapper_ext-0.2.0 lib/mongomapper_ext/types/timestamp.rb
mongomapper_ext-0.1.5 lib/mongomapper_ext/types/timestamp.rb
mongomapper_ext-0.1.4 lib/mongomapper_ext/types/timestamp.rb
mongomapper_ext-0.1.3 lib/mongomapper_ext/types/timestamp.rb
mongomapper_ext-0.1.2 lib/mongomapper_ext/types/timestamp.rb
mongomapper_ext-0.1.1 lib/mongomapper_ext/types/timestamp.rb
mongomapper_ext-0.1.0 lib/mongomapper_ext/types/timestamp.rb
mongomapper_ext-0.0.4 lib/mongomapper_ext/types/timestamp.rb