Class: Lox::Console
- Inherits:
-
Object
- Object
- Lox::Console
- Defined in:
- lib/lox/console.rb
Instance Attribute Summary collapse
-
#terminal ⇒ Object
readonly
Returns the value of attribute terminal.
Instance Method Summary collapse
- #each_line ⇒ Object
-
#initialize(terminal) ⇒ Console
constructor
A new instance of Console.
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
#terminal ⇒ Object (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_line ⇒ Object
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 |