Class: PhlexUI::ContextMenu::Item

Inherits:
Base
  • Object
show all
Defined in:
lib/phlex_ui/context_menu/item.rb

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods inherited from Base

#before_template

Constructor Details

#initialize(href: "#", checked: false, shortcut: nil, disabled: false, **attrs) ⇒ Item

Returns a new instance of Item.



5
6
7
8
9
10
11
12
# File 'lib/phlex_ui/context_menu/item.rb', line 5

def initialize(href: "#", checked: false, shortcut: nil, disabled: false, **attrs)
  @href = href
  @checked = checked
  @shortcut = shortcut
  @disabled = disabled

  super(**attrs)
end

Instance Method Details

#view_template(&block) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/phlex_ui/context_menu/item.rb', line 14

def view_template(&block)
  a(**attrs) do
    render_checkmark if @checked
    yield
    render_shortcut if @shortcut
  end
end