Class: Repla::REPL::Wrapper
- Inherits:
-
Object
- Object
- Repla::REPL::Wrapper
- Defined in:
- lib/repla/repl.rb
Overview
Wrapper
Instance Method Summary collapse
-
#initialize(command) ⇒ Wrapper
constructor
A new instance of Wrapper.
- #parse_input(input) ⇒ Object
- #write_input(input) ⇒ Object
Constructor Details
#initialize(command) ⇒ Wrapper
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/repla/repl.rb', line 14 def initialize(command) PTY.spawn(command) do |output, input, _pid| Thread.new do output.each do |line| output_controller.parse_output(line) end end @input = input end end |
Instance Method Details
#parse_input(input) ⇒ Object
25 26 27 28 |
# File 'lib/repla/repl.rb', line 25 def parse_input(input) input_controller.parse_input(input) write_input(input) end |
#write_input(input) ⇒ Object
30 31 32 |
# File 'lib/repla/repl.rb', line 30 def write_input(input) @input.write(input) end |