This gem provides a value class, IntTime
, that represents a 24-hour format time.
gem 'int_time'
require 'int_time'
# from integer
IntTime.from(1435)
# => #<IntTime @hour=14, @minute=35>
# from string
IntTime.from("14:35")
# => #<IntTime @hour=14, @minute=35>
IntTime.to_str(1435)
# => 14:35
IntTime.to_int("14:35")
# => 1435