Class: SplitTime::Compute
- Inherits:
-
Object
- Object
- SplitTime::Compute
- Defined in:
- lib/split_time/compute.rb
Instance Method Summary collapse
-
#initialize(start_date, end_date) ⇒ Compute
constructor
A new instance of Compute.
- #time_span ⇒ Object
Constructor Details
#initialize(start_date, end_date) ⇒ Compute
Returns a new instance of Compute.
6 7 8 9 10 11 |
# File 'lib/split_time/compute.rb', line 6 def initialize(start_date, end_date) @start_date = parse_date start_date @end_date = parse_date end_date @years = ( @start_date.year .. @end_date.year ).to_a end |
Instance Method Details
#time_span ⇒ Object
13 14 15 16 17 |
# File 'lib/split_time/compute.rb', line 13 def time_span @years.inject({}) do |hash, year| hash.merge({year => years(year)}) end end |