Class: TimeSpanner::DurationChain
- Inherits:
-
Object
- Object
- TimeSpanner::DurationChain
- Extended by:
- Forwardable
- Includes:
- Enumerable, TimeUnits
- Defined in:
- lib/time_spanner/duration_chain.rb
Instance Attribute Summary collapse
-
#remaining ⇒ Object
Returns the value of attribute remaining.
-
#reverse ⇒ Object
(also: #reverse?)
Returns the value of attribute reverse.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
-
#units ⇒ Object
Returns the value of attribute units.
Instance Method Summary collapse
-
#initialize(from, to, units) ⇒ DurationChain
constructor
A new instance of DurationChain.
Constructor Details
#initialize(from, to, units) ⇒ DurationChain
Returns a new instance of DurationChain.
14 15 16 17 18 19 20 |
# File 'lib/time_spanner/duration_chain.rb', line 14 def initialize from, to, units @from, @to = setup_times from, to @remaining = to.to_r - from.to_r @units = units.map &:new calculate! end |
Instance Attribute Details
#remaining ⇒ Object
Returns the value of attribute remaining.
8 9 10 |
# File 'lib/time_spanner/duration_chain.rb', line 8 def remaining @remaining end |
#reverse ⇒ Object Also known as: reverse?
Returns the value of attribute reverse.
8 9 10 |
# File 'lib/time_spanner/duration_chain.rb', line 8 def reverse @reverse end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
9 10 11 |
# File 'lib/time_spanner/duration_chain.rb', line 9 def to @to end |
#units ⇒ Object
Returns the value of attribute units.
8 9 10 |
# File 'lib/time_spanner/duration_chain.rb', line 8 def units @units end |