Class: HighLine::Menu::Item
Overview
Represents an Item of a HighLine::Menu.
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#help ⇒ Object
readonly
Returns the value of attribute help.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(name, attributes) ⇒ Item
constructor
A new instance of Item.
- #item_help ⇒ Object
Constructor Details
#initialize(name, attributes) ⇒ Item
Returns a new instance of Item.
19 20 21 22 23 24 |
# File 'lib/highline/menu/item.rb', line 19 def initialize(name, attributes) @name = name @text = attributes[:text] || @name @help = attributes[:help] @action = attributes[:action] end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
8 9 10 |
# File 'lib/highline/menu/item.rb', line 8 def action @action end |
#help ⇒ Object (readonly)
Returns the value of attribute help.
8 9 10 |
# File 'lib/highline/menu/item.rb', line 8 def help @help end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/highline/menu/item.rb', line 8 def name @name end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
8 9 10 |
# File 'lib/highline/menu/item.rb', line 8 def text @text end |
Instance Method Details
#item_help ⇒ Object
26 27 28 29 |
# File 'lib/highline/menu/item.rb', line 26 def item_help return {} unless help { name.to_s.downcase => help } end |