class Hedgelog::Scrubber
Public Class Methods
new(replacements = nil)
click to toggle source
# File lib/hedgelog/scrubber.rb, line 5 def initialize(replacements = nil) @replacements = [ScrubReplacement.new('password', '**********')] unless replacements.nil? replacements.each do |x| if x.instance_of?(ScrubReplacement) @replacements << x else @replacements << ScrubReplacement.new(x,'**********') end end end end
Public Instance Methods
scrub(data)
click to toggle source
# File lib/hedgelog/scrubber.rb, line 18 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