Class: RubyEventStore::InstrumentedSubscriptions

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_event_store/instrumented_subscriptions.rb

Instance Method Summary collapse

Constructor Details

#initialize(subscriptions, instrumentation) ⇒ InstrumentedSubscriptions

Returns a new instance of InstrumentedSubscriptions.



5
6
7
8
# File 'lib/ruby_event_store/instrumented_subscriptions.rb', line 5

def initialize(subscriptions, instrumentation)
  @subscriptions = subscriptions
  @instrumentation = instrumentation
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *arguments, &block) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/ruby_event_store/instrumented_subscriptions.rb', line 34

def method_missing(method_name, *arguments, &block)
  if respond_to?(method_name)
    subscriptions.public_send(method_name, *arguments, &block)
  else
    super
  end
end

Instance Method Details

#add_global_subscription(subscriber) ⇒ Object



16
17
18
19
20
# File 'lib/ruby_event_store/instrumented_subscriptions.rb', line 16

def add_global_subscription(subscriber)
  instrument(subscriber: subscriber) do
    subscriptions.add_global_subscription(subscriber)
  end
end

#add_subscription(subscriber, event_types) ⇒ Object



10
11
12
13
14
# File 'lib/ruby_event_store/instrumented_subscriptions.rb', line 10

def add_subscription(subscriber, event_types)
  instrument(subscriber: subscriber, event_types: event_types) do
    subscriptions.add_subscription(subscriber, event_types)
  end
end

#add_thread_global_subscription(subscriber) ⇒ Object



28
29
30
31
32
# File 'lib/ruby_event_store/instrumented_subscriptions.rb', line 28

def add_thread_global_subscription(subscriber)
  instrument(subscriber: subscriber) do
    subscriptions.add_thread_global_subscription(subscriber)
  end
end

#add_thread_subscription(subscriber, event_types) ⇒ Object



22
23
24
25
26
# File 'lib/ruby_event_store/instrumented_subscriptions.rb', line 22

def add_thread_subscription(subscriber, event_types)
  instrument(subscriber: subscriber, event_types: event_types) do
    subscriptions.add_thread_subscription(subscriber, event_types)
  end
end

#respond_to_missing?(method_name, _include_private) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/ruby_event_store/instrumented_subscriptions.rb', line 42

def respond_to_missing?(method_name, _include_private)
  subscriptions.respond_to?(method_name)
end