Class: Lox::Console

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(terminal) ⇒ Console

Returns a new instance of Console.



7
8
9
# File 'lib/lox/console.rb', line 7

def initialize(terminal)
  @terminal = terminal
end

Instance Attribute Details

#terminalObject (readonly)

Returns the value of attribute terminal.



5
6
7
# File 'lib/lox/console.rb', line 5

def terminal
  @terminal
end

Instance Method Details

#each_lineObject



11
12
13
14
15
16
17
# File 'lib/lox/console.rb', line 11

def each_line
  return enum_for(:each_line) unless block_given?

  while (line = readline)
    yield("#{line}\n")
  end
end