Class: MenuItem
- Inherits:
-
Gloo::Core::Obj
- Object
- Gloo::Core::Obj
- MenuItem
- Defined in:
- lib/menu_item.rb
Overview
- Author
-
Eric Crane ([email protected])
- Copyright
-
Copyright © 2020 Eric Crane. All rights reserved.
A CLI menu item. One element in a CLI menu.
Constant Summary collapse
- KEYWORD =
'menu_item'.freeze
- KEYWORD_SHORT =
'mitem'.freeze
- SHORTCUT =
'shortcut'.freeze
- DESCRIPTION =
'description'.freeze
- DO =
'do'.freeze
Class Method Summary collapse
-
.messages ⇒ Object
Get a list of message names that this object receives.
-
.short_typename ⇒ Object
The short name of the object type.
-
.typename ⇒ Object
The name of the object type.
Instance Method Summary collapse
-
#add_children_on_create? ⇒ Boolean
Does this object have children to add when an object is created in interactive mode? This does not apply during obj load, etc.
-
#add_default_children ⇒ Object
Add children to this object.
-
#description_value ⇒ Object
Get the action’s description.
-
#do_script ⇒ Object
Get the action’s script.
-
#shortcut_value ⇒ Object
Get the value of the menu item shortcut.
Class Method Details
.messages ⇒ Object
Get a list of message names that this object receives.
87 88 89 |
# File 'lib/menu_item.rb', line 87 def self. return super end |
.short_typename ⇒ Object
The short name of the object type.
25 26 27 |
# File 'lib/menu_item.rb', line 25 def self.short_typename return KEYWORD_SHORT end |
.typename ⇒ Object
The name of the object type.
18 19 20 |
# File 'lib/menu_item.rb', line 18 def self.typename return KEYWORD end |
Instance Method Details
#add_children_on_create? ⇒ Boolean
Does this object have children to add when an object is created in interactive mode? This does not apply during obj load, etc.
66 67 68 |
# File 'lib/menu_item.rb', line 66 def add_children_on_create? return true end |
#add_default_children ⇒ Object
Add children to this object. This is used by containers to add children needed for default configurations.
73 74 75 76 77 78 |
# File 'lib/menu_item.rb', line 73 def add_default_children fac = @engine.factory fac.create_string SHORTCUT, '', self fac.create_string DESCRIPTION, '', self fac.create_script DO, '', self end |
#description_value ⇒ Object
Get the action’s description. Returns nil if there is none.
44 45 46 47 48 49 |
# File 'lib/menu_item.rb', line 44 def description_value o = find_child DESCRIPTION return self.value unless o return o.value end |
#do_script ⇒ Object
Get the action’s script. Returns nil if there is none.
55 56 57 |
# File 'lib/menu_item.rb', line 55 def do_script return find_child DO end |
#shortcut_value ⇒ Object
Get the value of the menu item shortcut. Returns nil if there is none.
33 34 35 36 37 38 |
# File 'lib/menu_item.rb', line 33 def shortcut_value o = find_child SHORTCUT return self.name unless o return o.value end |