Class: Astronoby::Hms

Inherits:
Object
  • Object
show all
Defined in:
lib/astronoby/angles/hms.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hours, minutes, seconds) ⇒ Hms

Returns a new instance of Hms.



7
8
9
10
11
# File 'lib/astronoby/angles/hms.rb', line 7

def initialize(hours, minutes, seconds)
  @hours = hours
  @minutes = minutes
  @seconds = seconds
end

Instance Attribute Details

#hoursObject (readonly)

Returns the value of attribute hours.



5
6
7
# File 'lib/astronoby/angles/hms.rb', line 5

def hours
  @hours
end

#minutesObject (readonly)

Returns the value of attribute minutes.



5
6
7
# File 'lib/astronoby/angles/hms.rb', line 5

def minutes
  @minutes
end

#secondsObject (readonly)

Returns the value of attribute seconds.



5
6
7
# File 'lib/astronoby/angles/hms.rb', line 5

def seconds
  @seconds
end

Instance Method Details

#formatObject



13
14
15
# File 'lib/astronoby/angles/hms.rb', line 13

def format
  "#{hours}h #{minutes}m #{seconds}s"
end