module Coder
Nested
Definitions
def self.Time(value)
Type-cast for time values. See https://bugs.ruby-lang.org/issues/20298 for background.
Signature
-
parameter
value
Time || Integer || String || nil
Implementation
def self.Time(value)
case value
when ::Time
value
when Integer
::Time.at(value)
when String
::Time.new(value)
when nil
nil
else
value.to_time
end
end