Class: StandardCircuit::Subscribers::RailsEventAdapter Private
- Inherits:
-
Object
- Object
- StandardCircuit::Subscribers::RailsEventAdapter
- Defined in:
- lib/standard_circuit/subscribers.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Adapts a ‘call(name, payload)` subscriber to the Rails.event#subscribe contract, which delivers a Hash event with :name / :payload / :context / :tags / :source_location.
Instance Method Summary collapse
- #emit(event) ⇒ Object private
-
#initialize(subscriber) ⇒ RailsEventAdapter
constructor
private
A new instance of RailsEventAdapter.
Constructor Details
#initialize(subscriber) ⇒ RailsEventAdapter
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of RailsEventAdapter.
90 91 92 |
# File 'lib/standard_circuit/subscribers.rb', line 90 def initialize(subscriber) @subscriber = subscriber end |
Instance Method Details
#emit(event) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
94 95 96 97 98 99 |
# File 'lib/standard_circuit/subscribers.rb', line 94 def emit(event) name = event[:name] return unless name&.start_with?(EVENT_PATTERN) @subscriber.call(name, event[:payload] || {}) end |