Class: MaquinaComponents::DropdownMenuHelper::DropdownMenuItemBuilder

Inherits:
Object
  • Object
show all
Defined in:
app/helpers/maquina_components/dropdown_menu_helper.rb

Overview

Builder for individual menu items (supports shortcuts)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view_context) ⇒ DropdownMenuItemBuilder

Returns a new instance of DropdownMenuItemBuilder.



236
237
238
239
# File 'app/helpers/maquina_components/dropdown_menu_helper.rb', line 236

def initialize(view_context)
  @view = view_context
  @shortcut_html = nil
end

Instance Attribute Details

#shortcut_htmlObject (readonly)

Returns the value of attribute shortcut_html.



234
235
236
# File 'app/helpers/maquina_components/dropdown_menu_helper.rb', line 234

def shortcut_html
  @shortcut_html
end

Instance Method Details

#shortcut(text) ⇒ Object

Adds a keyboard shortcut

Parameters:

  • text (String)

    Shortcut text



244
245
246
# File 'app/helpers/maquina_components/dropdown_menu_helper.rb', line 244

def shortcut(text)
  @shortcut_html = @view.render("components/dropdown_menu/shortcut", text: text)
end