Module: LucaSupport::Range::ClassMethods

Defined in:
lib/luca_support/range.rb

Instance Method Summary collapse

Instance Method Details

#term_by_month(start_date, end_date, step = 1) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/luca_support/range.rb', line 24

def term_by_month(start_date, end_date, step = 1)
  Enumerator.new do |yielder|
    each_month = start_date
    while each_month <= end_date
      yielder << each_month
      each_month = each_month.next_month(step)
    end
  end
end