class Calendario::Year
A period of 365 or 366 days, in the Gregorian calendar, divided into 12 calendar months
Attributes
months[R]
Array of all calendar months
@api private @return [Array<Month>]
year_number[R]
The primitive numeric representation of a year
@api private @return [Integer]
Public Class Methods
new(year_number = 2020)
click to toggle source
Initialize a year
@api private @param [Integer] year_number
The primitive numeric representation of a year
# File lib/calendario/year.rb, line 26 def initialize(year_number = 2020) @year_number = year_number @months = 1.upto(12).map do |month_number| Month.new(year_number, month_number) end end
Public Instance Methods
days()
click to toggle source
An array of 365 or 365 dates representing every day of the year
@api private @return [Date]
# File lib/calendario/year.rb, line 56 def days @days ||= months.map(&:days).flatten end
first_day()
click to toggle source
The first day of the year (1st of January)
@api private @return [Date]
# File lib/calendario/year.rb, line 38 def first_day @first_day ||= months.first.first_day end
last_day()
click to toggle source
The last day of the year (31st of December)
@api private @return [Date]
# File lib/calendario/year.rb, line 47 def last_day @last_day ||= months.last.last_day end