Class: Arcanus::Input

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

Overview

Provides interface for collecting input from the user.

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ Input

Creates an Arcanus::Input wrapping the given IO stream.


9
10
11
# File 'lib/arcanus/input.rb', line 9

def initialize(input)
  @input = input
end

Instance Method Details

#get(noecho: false) ⇒ String?

Blocks until a line of input is returned from the input source.


16
17
18
19
20
21
22
# File 'lib/arcanus/input.rb', line 16

def get(noecho: false)
  if noecho
    @input.noecho(&:gets)
  else
    @input.gets
  end
end