Class: Mutant::Parallel::Pipe Private

Inherits:
Object
  • Object
show all
Includes:
Unparser::Adamantium
Defined in:
lib/mutant/parallel/pipe.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_io(io) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



17
18
19
20
# File 'lib/mutant/parallel/pipe.rb', line 17

def self.from_io(io)
  reader, writer = io.pipe(binmode: true)
  new(reader:, writer:)
end

.with(io) ⇒ undefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Run block with pipe in binmode

Returns:

  • (undefined)


11
12
13
14
15
# File 'lib/mutant/parallel/pipe.rb', line 11

def self.with(io)
  io.pipe(binmode: true) do |(reader, writer)|
    yield new(reader:, writer:)
  end
end

Instance Method Details

#to_readerIO

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parent reader end of the pipe

Returns:

  • (IO)


33
34
35
36
# File 'lib/mutant/parallel/pipe.rb', line 33

def to_reader
  writer.close
  reader
end

#to_writerIO

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Writer end of the pipe

Returns:

  • (IO)


25
26
27
28
# File 'lib/mutant/parallel/pipe.rb', line 25

def to_writer
  reader.close
  writer
end