Class: Calendario::Interval
- Inherits:
-
Object
- Object
- Calendario::Interval
- Includes:
- Comparable
- Defined in:
- lib/calendario/interval.rb
Overview
A list of one or more months
Instance Attribute Summary collapse
-
#months ⇒ Array<Month>
readonly
private
Array of all months in the period.
Instance Method Summary collapse
-
#initialize(first_year, first_month, last_year, last_month) ⇒ Interval
constructor
private
Initialize a time interval.
Constructor Details
#initialize(first_year, first_month, last_year, last_month) ⇒ Interval
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize a time interval
24 25 26 27 28 29 30 |
# File 'lib/calendario/interval.rb', line 24 def initialize(first_year, first_month, last_year, last_month) @first_year = first_year @first_month = first_month @last_year = last_year @last_month = last_month @months = (Month.new(first_year, first_month)..Month.new(last_year, last_month)).to_a end |
Instance Attribute Details
#months ⇒ Array<Month> (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Array of all months in the period
13 14 15 |
# File 'lib/calendario/interval.rb', line 13 def months @months end |