Class: TimeSpanner::TimeSpan
- Inherits:
-
Hash
- Object
- Hash
- TimeSpanner::TimeSpan
- Includes:
- Errors
- Defined in:
- lib/time_spanner/time_span.rb
Instance Attribute Summary collapse
-
#unit_chain ⇒ Object
readonly
Returns the value of attribute unit_chain.
Instance Method Summary collapse
-
#initialize(from, to, unit_names = []) ⇒ TimeSpan
constructor
A new instance of TimeSpan.
Constructor Details
#initialize(from, to, unit_names = []) ⇒ TimeSpan
Returns a new instance of TimeSpan.
8 9 10 11 12 13 14 15 |
# File 'lib/time_spanner/time_span.rb', line 8 def initialize from, to, unit_names = [] validate! from, to units = TimeUnitCollector.new( unit_names ).units @unit_chain = DurationChain.new from.to_time, to.to_time, units build! end |
Instance Attribute Details
#unit_chain ⇒ Object (readonly)
Returns the value of attribute unit_chain.
6 7 8 |
# File 'lib/time_spanner/time_span.rb', line 6 def unit_chain @unit_chain end |