Class: Carnivore::Source::Spec
- Inherits:
-
Carnivore::Source
- Object
- Carnivore::Source
- Carnivore::Source::Spec
- Defined in:
- lib/carnivore/spec_helper.rb
Overview
Dummy source for testing used to capture payloads for inspection
Instance Attribute Summary (collapse)
-
- (TrueClass, FalseClass) auto_confirm
inherited
from Carnivore::Source
readonly
Auto confirm received messages.
-
- (TrueClass, FalseClass) auto_process
inherited
from Carnivore::Source
readonly
Start source processing on initialization.
-
- (Carnivore::Supervisor) callback_supervisor
inherited
from Carnivore::Source
readonly
Supervisor maintaining callback instances.
-
- (Array<Callback>) callbacks
inherited
from Carnivore::Source
readonly
Registered callbacks.
-
- (Array) confirmed
readonly
Messages confirmed.
-
- (Queue) message_loop
inherited
from Carnivore::Source
readonly
Local loop message queue.
-
- (Hash) message_registry
inherited
from Carnivore::Source
readonly
Registry of processed messages.
-
- (Queue) message_remote
inherited
from Carnivore::Source
readonly
Remote message queue.
-
- (String, Symbol) name
inherited
from Carnivore::Source
readonly
Name of source.
-
- (TrueClass, FalseClass) processing
inherited
from Carnivore::Source
readonly
Currently processing a message.
-
- (TrueClass, FalseClass) run_process
inherited
from Carnivore::Source
readonly
Message processing control switch.
Instance Method Summary (collapse)
-
- (TrueClass) confirm(payload, *args)
Capture confirmed messages.
-
- (Carnivore::Message) format(msg)
Format the message.
-
- (Spec) initialize(*args) { ... }
constructor
Creates new spec source.
-
- (Object) receive(*args)
Dummy receiver.
-
- (Array) setup(*args)
Setup the message store for payload storage.
-
- (TrueClass) transmit(*args)
Capture messages transmitted.
Constructor Details
- (Spec) initialize(*args) { ... }
Creates new spec source
71 72 73 74 |
# File 'lib/carnivore/spec_helper.rb', line 71 def initialize(*args, &block) super @confirmed = [] end |
Instance Attribute Details
- (TrueClass, FalseClass) auto_confirm (readonly) Originally defined in class Carnivore::Source
Returns auto confirm received messages
- (TrueClass, FalseClass) auto_process (readonly) Originally defined in class Carnivore::Source
Returns start source processing on initialization
- (Carnivore::Supervisor) callback_supervisor (readonly) Originally defined in class Carnivore::Source
Returns supervisor maintaining callback instances
- (Array<Callback>) callbacks (readonly) Originally defined in class Carnivore::Source
Returns registered callbacks
- (Array) confirmed (readonly)
Returns messages confirmed
65 66 67 |
# File 'lib/carnivore/spec_helper.rb', line 65 def confirmed @confirmed end |
- (Queue) message_loop (readonly) Originally defined in class Carnivore::Source
Returns local loop message queue
- (Hash) message_registry (readonly) Originally defined in class Carnivore::Source
Returns registry of processed messages
- (Queue) message_remote (readonly) Originally defined in class Carnivore::Source
Returns remote message queue
- (String, Symbol) name (readonly) Originally defined in class Carnivore::Source
Returns name of source
- (TrueClass, FalseClass) processing (readonly) Originally defined in class Carnivore::Source
Returns currently processing a message
- (TrueClass, FalseClass) run_process (readonly) Originally defined in class Carnivore::Source
Returns message processing control switch
Instance Method Details
- (TrueClass) confirm(payload, *args)
Capture confirmed messages
113 114 115 116 |
# File 'lib/carnivore/spec_helper.rb', line 113 def confirm(payload, *args) confirmed << payload true end |
- (Carnivore::Message) format(msg)
Format the message
101 102 103 104 105 106 |
# File 'lib/carnivore/spec_helper.rb', line 101 def format(msg) Message.new( :message => msg, :source => self ) end |
- (Object) receive(*args)
Dummy receiver
84 85 86 |
# File 'lib/carnivore/spec_helper.rb', line 84 def receive(*args) wait(:forever) end |
- (Array) setup(*args)
Setup the message store for payload storage
79 80 81 |
# File 'lib/carnivore/spec_helper.rb', line 79 def setup(*args) MessageStore.init end |
- (TrueClass) transmit(*args)
Capture messages transmitted
92 93 94 95 |
# File 'lib/carnivore/spec_helper.rb', line 92 def transmit(*args) MessageStore. << args.first true end |