class BusinessTime::ParsedTime
Attributes
hour[R]
min[R]
sec[R]
Public Class Methods
new(hour, min = 0, sec = 0)
click to toggle source
# File lib/business_time/parsed_time.rb, line 7 def initialize(hour, min = 0, sec = 0) @hour = hour @min = min @sec = sec end
parse(time_or_string)
click to toggle source
# File lib/business_time/parsed_time.rb, line 13 def self.parse(time_or_string) if time_or_string.is_a?(String) time = Time.parse(time_or_string) else time = time_or_string end new(time.hour, time.min, time.sec) end
Public Instance Methods
-(other)
click to toggle source
# File lib/business_time/parsed_time.rb, line 26 def -(other) (hour - other.hour) * 3600 + (min - other.min) * 60 + sec - other.sec end
<=>(other)
click to toggle source
# File lib/business_time/parsed_time.rb, line 30 def <=>(other) [hour, min, sec] <=> [other.hour, other.min, other.sec] end
to_s()
click to toggle source
# File lib/business_time/parsed_time.rb, line 22 def to_s "#{hour}:#{min}:#{sec}" end