Class: Hivent::Spec::Signal

Inherits:
AbstractSignal show all
Defined in:
lib/hivent/spec/signal.rb

Instance Attribute Summary

Attributes inherited from AbstractSignal

#client_id, #name, #producer

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractSignal

#receive

Constructor Details

#initialize(*args) ⇒ Signal

Returns a new instance of Signal.



18
19
20
# File 'lib/hivent/spec/signal.rb', line 18

def initialize(*args)
  super
end

Class Method Details

.messagesObject



14
15
16
# File 'lib/hivent/spec/signal.rb', line 14

def self.messages
  @store ||= []
end

.reset!Object



10
11
12
# File 'lib/hivent/spec/signal.rb', line 10

def self.reset!
  @store = []
end

Instance Method Details

#emit(_payload, version:, cid: nil, key: nil) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/hivent/spec/signal.rb', line 26

def emit(_payload, version:, cid: nil, key: nil)
  super.tap do |message|
    begin
      Hivent.emitter.broadcast(message)

      report_success(name, version, message)
    rescue => e
      report_failure(e, message)
    end
  end
end

#messagesObject



22
23
24
# File 'lib/hivent/spec/signal.rb', line 22

def messages
  self.class.messages
end