Class: Terrapin::CommandLine::MultiPipe

Inherits:
Object
  • Object
show all
Defined in:
lib/terrapin/command_line/multi_pipe.rb

Instance Method Summary collapse

Constructor Details

#initializeMultiPipe

Returns a new instance of MultiPipe.



4
5
6
7
# File 'lib/terrapin/command_line/multi_pipe.rb', line 4

def initialize
  @stdout_in, @stdout_out = IO.pipe
  @stderr_in, @stderr_out = IO.pipe
end

Instance Method Details

#outputObject



13
14
15
# File 'lib/terrapin/command_line/multi_pipe.rb', line 13

def output
  Output.new(@stdout_output, @stderr_output)
end

#pipe_optionsObject



9
10
11
# File 'lib/terrapin/command_line/multi_pipe.rb', line 9

def pipe_options
  { out: @stdout_out, err: @stderr_out }
end

#read_and_then(&block) ⇒ Object



17
18
19
20
21
22
# File 'lib/terrapin/command_line/multi_pipe.rb', line 17

def read_and_then(&block)
  close_write
  read
  block.call
  close_read
end