class Tomlrb::LocalTime
Public Class Methods
new(hour, min, sec)
click to toggle source
# File lib/tomlrb/local_time.rb, line 9 def initialize(hour, min, sec) @time = Time.new(0, 1, 1, hour, min, sec, '-00:00') @sec = sec end
Public Instance Methods
==(other)
click to toggle source
# File lib/tomlrb/local_time.rb, line 29 def ==(other) other.kind_of?(self.class) && @time == other.to_time(0, 1, 1) end
inspect()
click to toggle source
# File lib/tomlrb/local_time.rb, line 34 def inspect "#<#{self.class}: #{to_s}>" end
to_s()
click to toggle source
# File lib/tomlrb/local_time.rb, line 23 def to_s frac = (@sec - sec) frac_str = frac == 0 ? '' : "#{frac.to_s[1..-1]}" @time.strftime("%T") << frac_str end
to_time(year, month, day, offset='-00:00')
click to toggle source
@param year [Integer] @param month [Integer] @param day [Integer] @param offset see {LocalDateTime#to_time} @return [Time] the time of the date specified by params
# File lib/tomlrb/local_time.rb, line 19 def to_time(year, month, day, offset='-00:00') Time.new(year, month, day, hour, min, @sec, offset) end