Lustra::TimeInDay
Lustra::TimeInDay represents the "time" object of PostgreSQL
It can be converted automatically from/to a time column.
It offers helpers which makes it usable also as a stand alone.
Usage example
time = Lustra::TimeInDay.parse("12:33")
puts time.hour # 12
puts time.minutes # 0
Time.local.at(time) # Today at 12:33:00
time.to_s # 12:33:00
time.to_s(false) # don't show seconds => 12:33
time = time + 2.minutes # 12:35
As with Interval, you might wanna use it as a column (use underlying time type in PostgreSQL):
class MyModel
include Lustra::Model
column time_in_day : Lustra::TimeInDay
end
Constructors
Class methods
Instance methods
Returns an unambiguous and information-rich string representation of this object, typically intended for developers.
This method should usually not be overridden. It delegates to
#inspect(IO) which can be overridden for custom implementations.
Also see #to_s.
Returns a nicely readable and concise string representation of this object, typically intended for users.
This method should usually not be overridden. It delegates to
#to_s(IO) which can be overridden for custom implementations.
Also see #inspect.