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

YEAR_SIZE =
12
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, since: nil, till: nil, disabled_months: []) ⇒ MonthsOfYear

Returns a new instance of MonthsOfYear.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/stimulus_plumbers/components/calendar/turbo/months_of_year.rb', line 14

def initialize(
  template,
  date: Date.today,
  today: Date.today,
  selected_date: nil,
  format: :short,
  since: nil,
  till: nil,
  disabled_months: []
)
  super(template)
  @date           = date
  @today          = today
  @selected_date  = selected_date
  @format         = format
  @since          = since
  @till           = till
  @disabled_months = disabled_months
end

Instance Attribute Details

#dateObject (readonly)

Returns the value of attribute date.



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

def date
  @date
end

#disabled_monthsObject (readonly)

Returns the value of attribute disabled_months.



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

def disabled_months
  @disabled_months
end

#formatObject (readonly)

Returns the value of attribute format.



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

def format
  @format
end

#selected_dateObject (readonly)

Returns the value of attribute selected_date.



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

def selected_date
  @selected_date
end

#sinceObject (readonly)

Returns the value of attribute since.



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

def since
  @since
end

#tillObject (readonly)

Returns the value of attribute till.



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

def till
  @till
end

#todayObject (readonly)

Returns the value of attribute today.



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

def today
  @today
end

Instance Method Details

#renderObject



34
35
36
# File 'lib/stimulus_plumbers/components/calendar/turbo/months_of_year.rb', line 34

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