module RedisModel::Types::Timestamp

Internal: Methods needed for timestamp type.

Public Instance Methods

set(timestamp) click to toggle source

Public: Sets ISO 8601 string of timestamp to Redis.

timestamp - Timestamp to store.

Returns nothing.

Calls superclass method RedisModel::Types::BaseValue#set
# File lib/redis_model/types/timestamp.rb, line 21
def set(timestamp)
  super(timestamp.utc.iso8601)
end
to_time() click to toggle source

Public: Reads value on Redis and converts it to timestamp.

Returns Time object.

# File lib/redis_model/types/timestamp.rb, line 10
def to_time
  Time.parse(get) rescue nil
end
Also aliased as: to_value
to_value()
Alias for: to_time