Class: Calrom::Year

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

Instance Method Summary collapse

Methods inherited from DateRange

#spans_multiple_months?

Constructor Details

#initialize(year) ⇒ Year

Returns a new instance of Year.



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

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

Instance Method Details

#each_monthObject



41
42
43
44
45
# File 'lib/calrom/date_range.rb', line 41

def each_month
  return to_enum(:each_month) unless block_given?

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

#to_sObject



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

def to_s
  first.year.to_s
end