class Haora::Duration
Attributes
minutes[R]
Public Class Methods
new(minutes = 0)
click to toggle source
# File lib/haora/timestamp.rb, line 79 def initialize(minutes = 0) @minutes = minutes end
of_minutes(minutes)
click to toggle source
# File lib/haora/timestamp.rb, line 52 def self.of_minutes(minutes) Duration.new(minutes) end
Public Instance Methods
+(other)
click to toggle source
# File lib/haora/timestamp.rb, line 69 def +(other) Duration.of_minutes(@minutes + other.minutes) end
==(other)
click to toggle source
# File lib/haora/timestamp.rb, line 65 def ==(other) @minutes == other.minutes end
hours()
click to toggle source
# File lib/haora/timestamp.rb, line 61 def hours minutes / 60.0 end
parts()
click to toggle source
# File lib/haora/timestamp.rb, line 56 def parts { hours: @minutes / 60, minutes: @minutes % 60 } end
to_s()
click to toggle source
# File lib/haora/timestamp.rb, line 73 def to_s format('%d h %d m', parts[:hours], parts[:minutes]) end