Class: Vop::TestableShellInput
- Inherits:
-
Object
- Object
- Vop::TestableShellInput
- Defined in:
- lib/vop/shell/shell_input_testable.rb
Instance Attribute Summary collapse
-
#answers ⇒ Object
Returns the value of attribute answers.
-
#exit ⇒ Object
readonly
Returns the value of attribute exit.
Instance Method Summary collapse
-
#initialize ⇒ TestableShellInput
constructor
A new instance of TestableShellInput.
- #read(prompt) ⇒ Object
Constructor Details
#initialize ⇒ TestableShellInput
Returns a new instance of TestableShellInput.
8 9 10 11 |
# File 'lib/vop/shell/shell_input_testable.rb', line 8 def initialize @answers = [] @exit = false end |
Instance Attribute Details
#answers ⇒ Object
Returns the value of attribute answers.
5 6 7 |
# File 'lib/vop/shell/shell_input_testable.rb', line 5 def answers @answers end |
#exit ⇒ Object (readonly)
Returns the value of attribute exit.
6 7 8 |
# File 'lib/vop/shell/shell_input_testable.rb', line 6 def exit @exit end |
Instance Method Details
#read(prompt) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/vop/shell/shell_input_testable.rb', line 13 def read(prompt) answer = @answers.shift if answer.nil? raise "no more pre-defined answers (asked for '#{prompt}')" end answer end |