Class: UserInput

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

Overview

will handle user input - will to quit the program, input from the console

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeUserInput

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

#exitObject

Returns the value of attribute exit.



8
9
10
# File 'lib/KeeperChallenge.rb', line 8

def exit
  @exit
end

#inputObject

Returns the value of attribute input.



8
9
10
# File 'lib/KeeperChallenge.rb', line 8

def input
  @input
end

Instance Method Details

#get_inputObject



14
15
16
17
18
# File 'lib/KeeperChallenge.rb', line 14

def get_input
  print '> '
  result = input.gets.chomp()
  return result
end