Class: Vigilem::Core::TransferAgent
- Inherits:
-
Object
- Object
- Vigilem::Core::TransferAgent
- Extended by:
- Forwardable, Support::ObjSpace
- Defined in:
- lib/vigilem/core/transfer_agent.rb
Overview
facade for demultiplexer <-> multiplexer coupling
Instance Attribute Summary collapse
-
#demultiplexer ⇒ Object
readonly
Returns the value of attribute demultiplexer.
-
#multiplexer ⇒ Object
readonly
Returns the value of attribute multiplexer.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(demuxer, muxer) ⇒ TransferAgent
constructor
sets the input on demultiplexer to the ouput of multiplexer if both are nil it sets it to an Array.
-
#relay(num_of_events = 1) ⇒ NilClass
checks.
Constructor Details
#initialize(demuxer, muxer) ⇒ TransferAgent
sets the input on demultiplexer to the ouput of multiplexer if both are nil it sets it to an Array
36 37 38 39 40 41 |
# File 'lib/vigilem/core/transfer_agent.rb', line 36 def initialize(demuxer, muxer) @demultiplexer, @multiplexer = demuxer, muxer if (junction = (din = demultiplexer.input) || (mout = multiplexer.out)).nil? or not mout.equal?(din) @demultiplexer.input = @multiplexer.out = (junction || []) end end |
Instance Attribute Details
#demultiplexer ⇒ Object (readonly)
Returns the value of attribute demultiplexer.
20 21 22 |
# File 'lib/vigilem/core/transfer_agent.rb', line 20 def demultiplexer @demultiplexer end |
#multiplexer ⇒ Object (readonly)
Returns the value of attribute multiplexer.
20 21 22 |
# File 'lib/vigilem/core/transfer_agent.rb', line 20 def multiplexer @multiplexer end |
Class Method Details
.inherited(base) ⇒ Object
59 60 61 |
# File 'lib/vigilem/core/transfer_agent.rb', line 59 def inherited(base) base.extend Support::ObjSpace end |
.new(*args) ⇒ Object
28 29 30 |
# File 'lib/vigilem/core/transfer_agent.rb', line 28 def self.new(*args) obj_register(super(*args)) end |
Instance Method Details
#relay(num_of_events = 1) ⇒ NilClass
checks
46 47 48 49 50 |
# File 'lib/vigilem/core/transfer_agent.rb', line 46 def relay(num_of_events=1) multiplexer.mux(num_of_events) demultiplexer.demux(num_of_events) nil end |