Class: Choice
- Inherits:
-
Object
- Object
- Choice
- Defined in:
- lib/choice.rb
Instance Attribute Summary collapse
-
#choices ⇒ Object
readonly
Returns the value of attribute choices.
Instance Method Summary collapse
- #add(command, msg) ⇒ Object
-
#initialize(msg, choices) ⇒ Choice
constructor
A new instance of Choice.
- #prompt ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(msg, choices) ⇒ Choice
Returns a new instance of Choice.
6 7 8 9 |
# File 'lib/choice.rb', line 6 def initialize msg, choices @msg = msg @choices = choices end |
Instance Attribute Details
#choices ⇒ Object (readonly)
Returns the value of attribute choices.
4 5 6 |
# File 'lib/choice.rb', line 4 def choices @choices end |
Instance Method Details
#add(command, msg) ⇒ Object
20 21 22 |
# File 'lib/choice.rb', line 20 def add(command, msg) @choices[command] = msg end |
#prompt ⇒ Object
11 12 13 14 |
# File 'lib/choice.rb', line 11 def prompt put_prompt_msg get_prompt_resp end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/choice.rb', line 16 def to_s @choices end |