Class: HotwireCombobox::Listbox::Group

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/hotwire_combobox/listbox/group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options:) ⇒ Group

Returns a new instance of Group.



6
7
8
9
# File 'app/presenters/hotwire_combobox/listbox/group.rb', line 6

def initialize(name, options:)
  @name = name
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'app/presenters/hotwire_combobox/listbox/group.rb', line 4

def options
  @options
end

Instance Method Details

#render_in(view) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'app/presenters/hotwire_combobox/listbox/group.rb', line 11

def render_in(view)
  view.tag.ul **group_attrs do
    view.concat view.tag.li(name, **label_attrs)

    options.map do |option|
      view.concat view.render(option)
    end
  end
end