class HighLine::Menu::Item
Represents an Item
of a HighLine::Menu
.
Attributes
action[R]
help[R]
name[R]
text[R]
Public Class Methods
new(name, attributes)
click to toggle source
@param name [String] The name that is matched against the user input @param attributes [Hash] options Hash to tailor menu item to your needs @option attributes text: [String] The text that displays for that
choice (defaults to name)
@option attributes help: [String] help/hint string to be displayed. @option attributes action: [Block] a block that gets called when choice
is selected
# 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
Public Instance Methods
item_help()
click to toggle source
# File lib/highline/menu/item.rb, line 26 def item_help return {} unless help { name.to_s.downcase => help } end