Class: RussianWorkdays::Month

Inherits:
CollectionPreset show all
Defined in:
lib/russian_workdays/month.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(year = Date.today.year, month = 1) ⇒ Month

Returns a new instance of Month.

Raises:



10
11
12
13
14
15
16
# File 'lib/russian_workdays/month.rb', line 10

def initialize(year = Date.today.year, month = 1)
  raise MissingYearError, year unless DATES.key?(year)
  raise ArgumentError, 'Must be a number between 1 and 12' unless (1..12).include?(month)

  @year = year
  @month = month
end

Instance Attribute Details

#monthObject (readonly)

Returns the value of attribute month.



8
9
10
# File 'lib/russian_workdays/month.rb', line 8

def month
  @month
end

#yearObject (readonly)

Returns the value of attribute year.



8
9
10
# File 'lib/russian_workdays/month.rb', line 8

def year
  @year
end