Class: Calrom::Year

Inherits:
DateRange show all
Defined in:
lib/calrom/date_range.rb

Instance Method Summary collapse

Constructor Details

#initialize(year) ⇒ Year

Returns a new instance of Year.



29
30
31
# File 'lib/calrom/date_range.rb', line 29

def initialize(year)
  super Date.new(year, 1, 1), Date.new(year, 12, 31)
end

Instance Method Details

#each_monthObject



37
38
39
40
41
# File 'lib/calrom/date_range.rb', line 37

def each_month
  return to_enum(:each_month) unless block_given?

  1.upto(12) {|month| yield Month.new(first.year, month) }
end

#to_sObject



33
34
35
# File 'lib/calrom/date_range.rb', line 33

def to_s
  first.year.to_s
end