Class: Choice

Inherits:
Object
  • Object
show all
Defined in:
lib/choice.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#choicesObject (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

#promptObject



11
12
13
14
# File 'lib/choice.rb', line 11

def prompt
  put_prompt_msg
  get_prompt_resp
end

#to_sObject



16
17
18
# File 'lib/choice.rb', line 16

def to_s
  @choices
end