Class: HandyToolbox::ToolMenuItem
- Inherits:
-
Object
- Object
- HandyToolbox::ToolMenuItem
- Defined in:
- lib/handy_toolbox/tool_menu_item.rb
Constant Summary collapse
- ICON =
' '.freeze
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#tool ⇒ Object
readonly
Returns the value of attribute tool.
Instance Method Summary collapse
- #icon ⇒ Object
-
#initialize(parent, tool) ⇒ ToolMenuItem
constructor
A new instance of ToolMenuItem.
- #to_s ⇒ Object
Constructor Details
#initialize(parent, tool) ⇒ ToolMenuItem
Returns a new instance of ToolMenuItem.
9 10 11 12 13 |
# File 'lib/handy_toolbox/tool_menu_item.rb', line 9 def initialize(parent, tool) @id = Ids.next @parent = parent @tool = tool end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/handy_toolbox/tool_menu_item.rb', line 7 def id @id end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
7 8 9 |
# File 'lib/handy_toolbox/tool_menu_item.rb', line 7 def parent @parent end |
#tool ⇒ Object (readonly)
Returns the value of attribute tool.
7 8 9 |
# File 'lib/handy_toolbox/tool_menu_item.rb', line 7 def tool @tool end |
Instance Method Details
#icon ⇒ Object
23 24 25 |
# File 'lib/handy_toolbox/tool_menu_item.rb', line 23 def icon ICON end |
#to_s ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/handy_toolbox/tool_menu_item.rb', line 15 def to_s if @tool.desc.nil? @tool.name else [@tool.name, @tool.desc] end end |