Class: Rollbar::Scrubbers::URL

Inherits:
Object
  • Object
show all
Defined in:
lib/rollbar/scrubbers/url.rb

Constant Summary collapse

SCRUB_ALL =
:scrub_all

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(*args) ⇒ Object



11
12
13
# File 'lib/rollbar/scrubbers/url.rb', line 11

def self.call(*args)
  new.call(*args)
end

Instance Method Details

#call(options = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rollbar/scrubbers/url.rb', line 15

def call(options = {})
  url = ascii_encode(options[:url])

  filter(url,
         build_regex(options[:scrub_fields]),
         options[:scrub_user],
         options[:scrub_password],
         options.fetch(:randomize_scrub_length, true),
         options[:scrub_fields].include?(SCRUB_ALL),
         build_whitelist_regex(options[:whitelist] || []))
rescue StandardError => e
  message = '[Rollbar] There was an error scrubbing the url: ' \
    "#{e}, options: #{options.inspect}"
  Rollbar.logger.error(message)
  url
end