Class: Calendario::Interval

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/calendario/interval.rb

Overview

A list of one or more months

Instance Attribute Summary collapse

Instance Method Summary collapse

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

Parameters:

  • first_year (Integer)

    The primitive representation of the first year

  • first_month (Integer)

    The primitive representation of the first month

  • last_year (Integer)

    The primitive representation of the last year

  • last_month (Integer)

    The primitive representation of the last month



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

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

Returns:



13
14
15
# File 'lib/calendario/interval.rb', line 13

def months
  @months
end