Class: Raygun::Apm::Blacklist::Translator::RubyTranslator

Inherits:
Object
  • Object
show all
Defined in:
lib/raygun/apm/blacklist/translator.rb

Constant Summary collapse

COMMENT =

Foo::Bar#baz Foo::Bar.baz

/^#.*/
ANONYMOUS =
/^#<.*>?/
NAMESPACE =
/::/
NAMESPACE_ONLY =
/::$/
METHOD =
/#|\./
LETTER_CASE =
/^[A-Z]/

Instance Method Summary collapse

Instance Method Details

#translate(filter) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/raygun/apm/blacklist/translator.rb', line 15

def translate(filter)
  path, method = nil, nil
  if filter !~ COMMENT && filter !~ ANONYMOUS
    if filter.end_with?("#")
      path = filter
    else
      path, method = filter.split(METHOD)
    end
    # .NET fallback
    return if method =~ LETTER_CASE && !method.start_with?("Ruby")
    if path == path.downcase
      method = path
      path = nil
    end

    # .NET fallback
    return if method =~ NAMESPACE
    [path, method]
  elsif filter =~ ANONYMOUS
    _, klass, method = filter.split(METHOD)
    ["##{klass}", method]
  else
    nil
  end
end