Class: SimpleCalendar::WeekCalendar

Inherits:
Calendar
  • Object
show all
Defined in:
lib/simple_calendar/week_calendar.rb

Constant Summary

Constants inherited from Calendar

Calendar::PARAM_KEY_BLACKLIST

Instance Attribute Summary

Attributes inherited from Calendar

#options, #view_context

Instance Method Summary collapse

Methods inherited from Calendar

#initialize, #render, #td_classes_for, #url_for_next_view, #url_for_previous_view

Constructor Details

This class inherits a constructor from SimpleCalendar::Calendar

Instance Method Details

#end_weekObject



12
13
14
# File 'lib/simple_calendar/week_calendar.rb', line 12

def end_week
  week_number + number_of_weeks - 1
end

#number_of_weeksObject



8
9
10
# File 'lib/simple_calendar/week_calendar.rb', line 8

def number_of_weeks
  options.fetch(:number_of_weeks, 1)
end

#week_numberObject



3
4
5
6
# File 'lib/simple_calendar/week_calendar.rb', line 3

def week_number
  format = (Date.beginning_of_week == :sunday) ? "%U" : "%W"
  start_date.beginning_of_week.strftime(format).to_i
end