class RunTimeSettings::Type::Time
Time
¶ ↑
Custom type caster for Time
. Values are converted to an integer representing seconds since epoch for storage in the database, then converted back to Time
on the way out.
This is only accurate to the second; milliseconds are lost.
Public Instance Methods
deserialize(value)
click to toggle source
called by read, should return Time
instance
# File lib/run_time_settings/type/time.rb, line 13 def deserialize(value) ::Time.at(value.to_i) end
serialize(value)
click to toggle source
called by write, should convert to unix epoch for storage in database
# File lib/run_time_settings/type/time.rb, line 18 def serialize(value) value.to_i end