Class: TwitterCldr::Shared::DayPeriods::Timestamp

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/twitter_cldr/shared/day_periods.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hour, min, sec) ⇒ Timestamp

Returns a new instance of Timestamp.



17
18
19
20
21
# File 'lib/twitter_cldr/shared/day_periods.rb', line 17

def initialize(hour, min, sec)
  @hour = hour
  @min = min
  @sec = sec
end

Instance Attribute Details

#hourObject (readonly)

Returns the value of attribute hour.



15
16
17
# File 'lib/twitter_cldr/shared/day_periods.rb', line 15

def hour
  @hour
end

#minObject (readonly)

Returns the value of attribute min.



15
16
17
# File 'lib/twitter_cldr/shared/day_periods.rb', line 15

def min
  @min
end

#secObject (readonly)

Returns the value of attribute sec.



15
16
17
# File 'lib/twitter_cldr/shared/day_periods.rb', line 15

def sec
  @sec
end

Instance Method Details

#<=>(other) ⇒ Object



27
28
29
# File 'lib/twitter_cldr/shared/day_periods.rb', line 27

def <=>(other)
  to_f <=> other.to_f
end

#to_fObject



23
24
25
# File 'lib/twitter_cldr/shared/day_periods.rb', line 23

def to_f
  @to_f ||= hour * 60 * 60 + min * 60.0 + sec
end