Class: Otel::ActiveSupportSubscriber::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/otel/active_support_subscriber/config.rb

Instance Method Summary collapse

Instance Method Details

#subscribe_toObject



6
7
8
# File 'lib/otel/active_support_subscriber/config.rb', line 6

def subscribe_to
  @subscribe_to ||= []
end

#subscribe_to=(events) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/otel/active_support_subscriber/config.rb', line 10

def subscribe_to=(events)
  @subscribe_to = Array(events).flat_map do |e|
    case
    when e.is_a?(Regexp) then e
    when !e.is_a?(String)
    when e[0] == "/" && e[-1] == "/" then Regexp.new(e[1...-1])
    else
      e.to_s
    end
  end
end