Class: UserInput
- Inherits:
-
Object
- Object
- UserInput
- Defined in:
- lib/KeeperChallenge.rb
Overview
will handle user input - will to quit the program, input from the console
Instance Attribute Summary collapse
-
#exit ⇒ Object
Returns the value of attribute exit.
-
#input ⇒ Object
Returns the value of attribute input.
Instance Method Summary collapse
- #get_input ⇒ Object
-
#initialize ⇒ UserInput
constructor
A new instance of UserInput.
Constructor Details
#initialize ⇒ UserInput
Returns a new instance of UserInput.
9 10 11 12 |
# File 'lib/KeeperChallenge.rb', line 9 def initialize exit = false self.input = $stdin end |
Instance Attribute Details
#exit ⇒ Object
Returns the value of attribute exit.
8 9 10 |
# File 'lib/KeeperChallenge.rb', line 8 def exit @exit end |
#input ⇒ Object
Returns the value of attribute input.
8 9 10 |
# File 'lib/KeeperChallenge.rb', line 8 def input @input end |
Instance Method Details
#get_input ⇒ Object
14 15 16 17 18 |
# File 'lib/KeeperChallenge.rb', line 14 def get_input print '> ' result = input.gets.chomp() return result end |