class MonthWeeks::Week

Attributes

end_date[R]
start_date[R]

Public Class Methods

new(start_date, end_date) click to toggle source
# File lib/month_weeks/week.rb, line 6
def initialize(start_date, end_date)
  @start_date = start_date
  @end_date = end_date
end

Public Instance Methods

dates() click to toggle source
# File lib/month_weeks/week.rb, line 11
def dates
  @dates ||= start_date.step(end_date).to_a
end
to_h() click to toggle source
# File lib/month_weeks/week.rb, line 15
def to_h
   { :start_date => start_date, :end_date => end_date, :dates => dates }
end
to_json(*args) click to toggle source
# File lib/month_weeks/week.rb, line 19
def to_json(*args)
  self.to_h.to_json(*args)
end
to_s() click to toggle source
# File lib/month_weeks/week.rb, line 23
def to_s
  "#{start_date.strftime} -- #{end_date.strftime}"
end