Class: HotwireCombobox::Listbox::Item
- Inherits:
-
Object
- Object
- HotwireCombobox::Listbox::Item
- Defined in:
- app/presenters/hotwire_combobox/listbox/item.rb
Class Method Summary collapse
Instance Method Summary collapse
- #collection ⇒ Object
-
#initialize(view, options, render_in:, include_blank:, **custom_methods) ⇒ Item
constructor
A new instance of Item.
Constructor Details
#initialize(view, options, render_in:, include_blank:, **custom_methods) ⇒ Item
Returns a new instance of Item.
8 9 10 11 12 13 14 |
# File 'app/presenters/hotwire_combobox/listbox/item.rb', line 8 def initialize(view, , render_in:, include_blank:, **custom_methods) @view = view @options = @render_in = render_in @include_blank = include_blank @custom_methods = custom_methods end |
Class Method Details
.collection_for(view, options, render_in:, include_blank:, **custom_methods) ⇒ Object
3 4 5 |
# File 'app/presenters/hotwire_combobox/listbox/item.rb', line 3 def collection_for(view, , render_in:, include_blank:, **custom_methods) new(view, , render_in: render_in, include_blank: include_blank, **custom_methods).collection end |
Instance Method Details
#collection ⇒ Object
16 17 18 19 20 |
# File 'app/presenters/hotwire_combobox/listbox/item.rb', line 16 def collection items = items.unshift(blank_option) if include_blank.present? Collection.new items end |