Class: ChildProcess::JRuby::Pump

Inherits:
Object
  • Object
show all
Defined in:
lib/childprocess/jruby/pump.rb

Constant Summary

BUFFER_SIZE =
2048

Instance Method Summary collapse

Constructor Details

#initialize(input, output) ⇒ Pump

Returns a new instance of Pump



6
7
8
9
10
# File 'lib/childprocess/jruby/pump.rb', line 6

def initialize(input, output)
  @input  = input
  @output = output
  @stop   = false
end

Instance Method Details

#runObject



17
18
19
20
21
# File 'lib/childprocess/jruby/pump.rb', line 17

def run
  @thread = Thread.new { pump }

  self
end

#stopObject



12
13
14
15
# File 'lib/childprocess/jruby/pump.rb', line 12

def stop
  @stop = true
  @thread && @thread.join
end