Class: Mutiny::Isolation::Pipe
- Inherits:
-
Struct
- Object
- Struct
- Mutiny::Isolation::Pipe
- Defined in:
- lib/mutiny/isolation/pipe.rb
Overview
An inter-process communication mechanism for sending and receiving (marshalled) data over an IO pipe
Instance Attribute Summary collapse
-
#reader ⇒ Object
Returns the value of attribute reader.
-
#writer ⇒ Object
Returns the value of attribute writer.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#reader ⇒ Object
Returns the value of attribute reader
5 6 7 |
# File 'lib/mutiny/isolation/pipe.rb', line 5 def reader @reader end |
#writer ⇒ Object
Returns the value of attribute writer
5 6 7 |
# File 'lib/mutiny/isolation/pipe.rb', line 5 def writer @writer end |
Class Method Details
Instance Method Details
#receive ⇒ Object
13 14 15 16 |
# File 'lib/mutiny/isolation/pipe.rb', line 13 def receive writer.close Marshal.load(reader.read) end |
#send(data) ⇒ Object
18 19 20 21 22 |
# File 'lib/mutiny/isolation/pipe.rb', line 18 def send(data) reader.close writer.write(Marshal.dump(data)) writer.close end |