Class: MultiProcess::Receiver
- Inherits:
-
Object
- Object
- MultiProcess::Receiver
- Defined in:
- lib/multi_process/receiver.rb
Overview
Can handle input from multiple processes and run custom actions on event and output.
Direct Known Subclasses
Instance Method Summary collapse
-
#message(process, name, message) ⇒ Object
Send a custom messages.
-
#pipe(process, name) ⇒ Object
Request a new pipe writer for given process and name.
Instance Method Details
#message(process, name, message) ⇒ Object
Send a custom messages.
33 34 35 |
# File 'lib/multi_process/receiver.rb', line 33 def (process, name, ) received process, name, end |
#pipe(process, name) ⇒ Object
Request a new pipe writer for given process and name.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/multi_process/receiver.rb', line 14 def pipe(process, name) reader, writer = IO.pipe Loop.instance.watch(reader) do |action, monitor| case action when :registered connected(process, name) when :ready received(process, name, read(monitor.io)) when :eof removed(process, name) end end writer end |