Class: RussianWorkdays::Month

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Month.

Raises:

  • (ArgumentError)


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

def initialize(year = Date.today.year, month = 1)
  raise ArgumentError, "Must be a number between 1 and 12" unless (1..12).include?(month)
  @dates = Collection.new(Date.new(year, month, 1)..Date.new(year, month, -1))
end