Class: Calrom::Year
- Defined in:
- lib/calrom/date_range.rb
Instance Method Summary collapse
- #each_month ⇒ Object
-
#initialize(year) ⇒ Year
constructor
A new instance of Year.
- #to_s ⇒ Object
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_month ⇒ Object
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_s ⇒ Object
33 34 35 |
# File 'lib/calrom/date_range.rb', line 33 def to_s first.year.to_s end |