Class: Raygun::Apm::Blacklist::Translator::RubyTranslator
- Inherits:
-
Object
- Object
- Raygun::Apm::Blacklist::Translator::RubyTranslator
- Defined in:
- lib/raygun/apm/blacklist/translator.rb
Constant Summary collapse
- COMMENT =
Foo::Bar#baz Foo::Bar.baz Foo::Bar::baz
/^#.*/
- ANONYMOUS =
/^#<.*>?/
- NAMESPACE =
/::/
- NAMESPACE_ONLY =
/::$/
- METHOD =
/#|\./
- LETTER_CASE =
/^[A-Z]/
- LOWER_CASE =
/^[a-z]/
Instance Method Summary collapse
Instance Method Details
#translate(filter) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/raygun/apm/blacklist/translator.rb', line 17 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 if path && (_method = path.split(NAMESPACE).last) =~ LOWER_CASE method = _method path.gsub!(Regexp.compile("::#{method}$"), "") end [path, method] elsif filter =~ ANONYMOUS _, klass, method = filter.split(METHOD) ["##{klass}", method] else nil end end |