Class: WebConsole::REPL::Wrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/webconsole/repl.rb

Instance Method Summary collapse

Constructor Details

#initialize(command) ⇒ Wrapper

Returns a new instance of Wrapper.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/webconsole/repl.rb', line 12

def initialize(command)

  PTY.spawn(command) do |output, input, pid|
    Thread.new do
      output.each { |line|
        output_controller.parse_output(line)
      }
    end
    @input = input
  end

end

Instance Method Details

#parse_input(input) ⇒ Object



25
26
27
28
# File 'lib/webconsole/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/webconsole/repl.rb', line 30

def write_input(input)
  @input.write(input)
end