Class: Overcommit::UserInput

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

Overview

Encapsulates prompting for and fetching input from a user.

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ UserInput

Returns a new instance of UserInput.

Parameters:

  • io (IO)

    device to fetch input from



5
6
7
8
9
# File 'lib/overcommit/user_input.rb', line 5

def initialize(io)
  @io = io

  reopen_tty
end

Instance Method Details

#getObject

Get a string of input from the user (up to the next newline character).



12
13
14
# File 'lib/overcommit/user_input.rb', line 12

def get
  @io.gets
end