Class: Hedgelog::Scrubber
- Inherits:
-
Object
- Object
- Hedgelog::Scrubber
- Defined in:
- lib/hedgelog/scrubber.rb
Instance Method Summary collapse
-
#initialize(replacements = nil) ⇒ Scrubber
constructor
A new instance of Scrubber.
-
#scrub(data) ⇒ Object
rubocop:disable Security/MarshalLoad.
Constructor Details
#initialize(replacements = nil) ⇒ Scrubber
Returns a new instance of Scrubber.
5 6 7 8 9 |
# File 'lib/hedgelog/scrubber.rb', line 5 def initialize(replacements = nil) @replacements = replacements || [ ScrubReplacement.new('password', '**********') ] end |
Instance Method Details
#scrub(data) ⇒ Object
rubocop:disable Security/MarshalLoad
12 13 14 15 16 17 18 19 |
# File 'lib/hedgelog/scrubber.rb', line 12 def scrub(data) # Need to Marshal.dump/Marshal.load to deep copy the input so that scrubbing doesn't change global state d = Marshal.load(Marshal.dump(data)) @replacements.each do |r| r.scrub_hash(d) end d end |