Class: HandyToolbox::Menu
- Inherits:
-
Object
- Object
- HandyToolbox::Menu
- Defined in:
- lib/handy_toolbox/menu.rb
Direct Known Subclasses
Constant Summary collapse
- ICON =
' + '.freeze
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#tools ⇒ Object
readonly
Returns the value of attribute tools.
Instance Method Summary collapse
- #icon ⇒ Object
-
#initialize(parent, group) ⇒ Menu
constructor
A new instance of Menu.
- #menu(group) {|menu| ... } ⇒ Object
- #menu_loader(group, loader_class) ⇒ Object
- #plugin(plugin_class) ⇒ Object
- #to_s ⇒ Object
- #tool(cmd, opts = {}) ⇒ Object
Constructor Details
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
6 7 8 |
# File 'lib/handy_toolbox/menu.rb', line 6 def children @children end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/handy_toolbox/menu.rb', line 6 def id @id end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
6 7 8 |
# File 'lib/handy_toolbox/menu.rb', line 6 def parent @parent end |
#tools ⇒ Object (readonly)
Returns the value of attribute tools.
6 7 8 |
# File 'lib/handy_toolbox/menu.rb', line 6 def tools @tools end |
Instance Method Details
#icon ⇒ Object
44 45 46 |
# File 'lib/handy_toolbox/menu.rb', line 44 def icon ICON end |
#menu(group) {|menu| ... } ⇒ Object
19 20 21 22 23 |
# File 'lib/handy_toolbox/menu.rb', line 19 def (group, &block) = Menu.new(self, group) children << yield if block_given? end |
#menu_loader(group, loader_class) ⇒ Object
25 26 27 28 29 |
# File 'lib/handy_toolbox/menu.rb', line 25 def (group, loader_class) loader = loader_class.new = MenuLoader.new(self, group, loader) children << end |
#plugin(plugin_class) ⇒ Object
35 36 37 38 |
# File 'lib/handy_toolbox/menu.rb', line 35 def plugin(plugin_class) plugin = plugin_class.new plugin.on_attach(self) end |
#to_s ⇒ Object
40 41 42 |
# File 'lib/handy_toolbox/menu.rb', line 40 def to_s @group end |
#tool(cmd, opts = {}) ⇒ Object
31 32 33 |
# File 'lib/handy_toolbox/menu.rb', line 31 def tool(cmd, opts = {}) children << ToolMenuItem.new(parent, Tool.new(cmd, opts)) end |