Class: TimeSpanner::DurationChain

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable, TimeUnits
Defined in:
lib/time_spanner/duration_chain.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#remainingObject

Returns the value of attribute remaining.



8
9
10
# File 'lib/time_spanner/duration_chain.rb', line 8

def remaining
  @remaining
end

#reverseObject 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

#toObject (readonly)

Returns the value of attribute to.



9
10
11
# File 'lib/time_spanner/duration_chain.rb', line 9

def to
  @to
end

#unitsObject

Returns the value of attribute units.



8
9
10
# File 'lib/time_spanner/duration_chain.rb', line 8

def units
  @units
end