Class: Quickdraw::Pipe

Inherits:
Object
  • Object
show all
Defined in:
lib/quickdraw/pipe.rb

Instance Method Summary collapse

Constructor Details

#initializePipe

Returns a new instance of Pipe.



4
5
6
# File 'lib/quickdraw/pipe.rb', line 4

def initialize
	@reader, @writer = IO.pipe
end

Instance Method Details

#readerObject



8
9
10
11
# File 'lib/quickdraw/pipe.rb', line 8

def reader
	@writer.close
	@reader
end

#with_readerObject



23
24
25
26
# File 'lib/quickdraw/pipe.rb', line 23

def with_reader
	@writer.close
	yield(@reader).tap { @reader.close }
end

#with_writerObject



18
19
20
21
# File 'lib/quickdraw/pipe.rb', line 18

def with_writer
	@reader.close
	yield(@writer).tap { @writer.close }
end

#writerObject



13
14
15
16
# File 'lib/quickdraw/pipe.rb', line 13

def writer
	@reader.close
	@writer
end