module Period::HasMany::Weeks

@author Lucas Billaudot <billau_l@modulotech.fr> @note when include this module provide itterable access to the weeks of the FreePeriod

Public Instance Methods

weeks() click to toggle source
# File lib/period/has_many/weeks.rb, line 7
def weeks
  @weeks ||= []
  return @weeks if @weeks.present?
  curr = from
  while curr <= to
    week = Period::Week.new(curr)
    @weeks << week if week.iso_date.in?(self)
    curr = curr.next_week
  end

  @weeks
end