Class: LCDProc::MenuItems::SubMenu
- Inherits:
-
LCDProc::Menu
- Object
- LCDProc::Menu
- LCDProc::MenuItems::SubMenu
- Includes:
- LCDProc::MenuItem
- Defined in:
- lib/lcdproc/menu_items/submenu.rb
Constant Summary collapse
0
Instance Attribute Summary
Attributes included from LCDProc::MenuItem
#id, #is_hidden, #lcdproc_event_type, #lcdproc_options, #lcdproc_type, #next, #parent_menu, #previous, #text
Attributes inherited from LCDProc::Menu
Instance Method Summary collapse
-
#initialize(user_options = {}, lcdproc_options = {}) ⇒ SubMenu
constructor
Creates a new SubMenu MenuItem object.
Methods included from LCDProc::MenuItem
add_support, #lcdproc_options_as_string, new, supported_types
Methods inherited from LCDProc::Menu
#add_item, #attach_to, #detach, #update
Constructor Details
#initialize(user_options = {}, lcdproc_options = {}) ⇒ SubMenu
Creates a new SubMenu MenuItem object.
The user_options
will accept a hash of the following MenuItem options.
-
:id
- The unique string that identifies this sub menu. Defaults to “SubMenuMenuItem_” + a sequence number.
The lcdproc_options
will accept a hash of the options to be passed to LCDd when creating or updating the sub menu.
-
:text
- The text to be displayed on the LCD for this sub menu. Defaults to the id.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/lcdproc/menu_items/submenu.rb', line 49 def initialize( = {}, = {} ) # Initialize the menu system with a nil client super( nil ) @lcdproc_options = {} if [:id].nil? @id = "SubMenuMenuItem_#{@@submenu_item_count}" else @id = [:id] end @lcdproc_type = "menu" @lcdproc_event_type = "(enter|leave)" @lcdproc_options[:text] = "#{@id}" @lcdproc_options.update( ) [ :text ].each { |s| @lcdproc_options[s].quotify! } @@submenu_item_count += 1 end |