Class: Solid::Result::EventLogs::Listeners

Inherits:
Object
  • Object
show all
Defined in:
lib/solid/result/event_logs/listeners.rb

Defined Under Namespace

Classes: Chain

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(listeners, around_and_then_listener, around_event_logs_listener) ⇒ Listeners

Returns a new instance of Listeners.



57
58
59
60
61
# File 'lib/solid/result/event_logs/listeners.rb', line 57

def initialize(listeners, around_and_then_listener, around_event_logs_listener)
  @listeners = listeners
  @around_and_then_listener = around_and_then_listener || Listener::Null
  @around_event_logs_listener = around_event_logs_listener || Listener::Null
end

Class Method Details

.[](*listeners) ⇒ Object



49
50
51
# File 'lib/solid/result/event_logs/listeners.rb', line 49

def self.[](*listeners)
  Chain.new(listeners)
end

Instance Method Details

#around_and_then(scope:, and_then:, &block) ⇒ Object



71
72
73
# File 'lib/solid/result/event_logs/listeners.rb', line 71

def around_and_then(scope:, and_then:, &block)
  around_and_then_listener.around_and_then(scope: scope, and_then: and_then, &block)
end

#around_event_logs(scope:, &block) ⇒ Object



67
68
69
# File 'lib/solid/result/event_logs/listeners.rb', line 67

def around_event_logs(scope:, &block)
  around_event_logs_listener.around_event_logs(scope: scope, &block)
end

#before_interruption(exception:, event_logs:) ⇒ Object



83
84
85
# File 'lib/solid/result/event_logs/listeners.rb', line 83

def before_interruption(exception:, event_logs:)
  listeners.each { _1.before_interruption(exception: exception, event_logs: event_logs) }
end

#on_finish(event_logs:) ⇒ Object



79
80
81
# File 'lib/solid/result/event_logs/listeners.rb', line 79

def on_finish(event_logs:)
  listeners.each { _1.on_finish(event_logs: event_logs) }
end

#on_record(record:) ⇒ Object



75
76
77
# File 'lib/solid/result/event_logs/listeners.rb', line 75

def on_record(record:)
  listeners.each { _1.on_record(record: record) }
end

#on_start(scope:) ⇒ Object



63
64
65
# File 'lib/solid/result/event_logs/listeners.rb', line 63

def on_start(scope:)
  listeners.each { _1.on_start(scope: scope) }
end