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
Returns a new instance of Wrapper.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/repla/repl.rb', line 14 def initialize(command) @mutex = Mutex.new 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
26 27 28 29 |
# File 'lib/repla/repl.rb', line 26 def parse_input(input) input_controller.parse_input(input) write_input(input) end |
#write_input(input) ⇒ Object
31 32 33 |
# File 'lib/repla/repl.rb', line 31 def write_input(input) @input.write(input) end |