Class: SimpleCalendar::MonthCalendar

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

Instance Attribute Summary

Attributes inherited from Calendar

#block, #events, #options, #view_context

Instance Method Summary collapse

Methods inherited from Calendar

#default_next_link, #default_previous_link, #default_td_classes, #events_for_date, #get_option, #initialize, #param_name, #render, #render_header, #render_table, #render_week, #render_weeks, #start_date

Constructor Details

This class inherits a constructor from SimpleCalendar::Calendar

Instance Method Details

#date_rangeObject



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

def date_range
  @date_range ||= start_date.beginning_of_month.beginning_of_week..start_date.end_of_month.end_of_week
end

#default_headerObject



7
8
9
# File 'lib/simple_calendar/month_calendar.rb', line 7

def default_header
  ->(start_date) {  :span, month_name(start_date), class: "calendar-header" }
end

#month_name(start_date) ⇒ Object



11
12
13
# File 'lib/simple_calendar/month_calendar.rb', line 11

def month_name(start_date)
  "#{I18n.t("date.month_names")[start_date.month]} #{start_date.year}"
end