Class: StimulusPlumbers::Components::Calendar::Turbo::MonthsOfYear

Inherits:
Plumber::Base
  • Object
show all
Defined in:
lib/stimulus_plumbers/components/calendar/turbo/months_of_year.rb

Constant Summary collapse

MONTHS_PER_ROW =
4
MONTH_FORMATS =
%i[narrow short long].freeze

Instance Attribute Summary collapse

Attributes inherited from Plumber::Base

#template

Instance Method Summary collapse

Methods inherited from Plumber::Base

#theme

Methods included from Plumber::Renderer

#set_slots, #slot_block_for, #slot_kwargs_for, #slot_renderable?

Methods included from Plumber::Options::Aria

#labelled_aria

Methods included from Plumber::Options::Html

#merge_html_options

Constructor Details

#initialize(template, date: Date.today, today: Date.today, selected_date: nil, format: :short) ⇒ MonthsOfYear

Returns a new instance of MonthsOfYear.



13
14
15
16
17
18
19
# File 'lib/stimulus_plumbers/components/calendar/turbo/months_of_year.rb', line 13

def initialize(template, date: Date.today, today: Date.today, selected_date: nil, format: :short)
  super(template)
  @date          = date
  @today         = today
  @selected_date = selected_date
  @format        = format
end

Instance Attribute Details

#dateObject (readonly)

Returns the value of attribute date.



11
12
13
# File 'lib/stimulus_plumbers/components/calendar/turbo/months_of_year.rb', line 11

def date
  @date
end

#formatObject (readonly)

Returns the value of attribute format.



11
12
13
# File 'lib/stimulus_plumbers/components/calendar/turbo/months_of_year.rb', line 11

def format
  @format
end

#selected_dateObject (readonly)

Returns the value of attribute selected_date.



11
12
13
# File 'lib/stimulus_plumbers/components/calendar/turbo/months_of_year.rb', line 11

def selected_date
  @selected_date
end

#todayObject (readonly)

Returns the value of attribute today.



11
12
13
# File 'lib/stimulus_plumbers/components/calendar/turbo/months_of_year.rb', line 11

def today
  @today
end

Instance Method Details

#renderObject



21
22
23
# File 'lib/stimulus_plumbers/components/calendar/turbo/months_of_year.rb', line 21

def render(...)
  render_months_of_year(...)
end