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
Methods inherited from DateRange
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_month ⇒ Object
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_s ⇒ Object
37 38 39 |
# File 'lib/calrom/date_range.rb', line 37 def to_s first.year.to_s end |