Class: Astronoby::Hms
- Inherits:
-
Object
- Object
- Astronoby::Hms
- Defined in:
- lib/astronoby/angles/hms.rb
Instance Attribute Summary collapse
-
#hours ⇒ Object
readonly
Returns the value of attribute hours.
-
#minutes ⇒ Object
readonly
Returns the value of attribute minutes.
-
#seconds ⇒ Object
readonly
Returns the value of attribute seconds.
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(hours, minutes, seconds) ⇒ Hms
constructor
A new instance of Hms.
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
#hours ⇒ Object (readonly)
Returns the value of attribute hours.
5 6 7 |
# File 'lib/astronoby/angles/hms.rb', line 5 def hours @hours end |
#minutes ⇒ Object (readonly)
Returns the value of attribute minutes.
5 6 7 |
# File 'lib/astronoby/angles/hms.rb', line 5 def minutes @minutes end |
#seconds ⇒ Object (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
#format ⇒ Object
13 14 15 |
# File 'lib/astronoby/angles/hms.rb', line 13 def format "#{hours}h #{minutes}m #{seconds}s" end |