lib/hedgelog/scrubber.rb in hedgelog-0.1.13.alpha.1 vs lib/hedgelog/scrubber.rb in hedgelog-0.2.0
- old
+ new
@@ -1,12 +1,19 @@
require 'hedgelog/scrub_replacement'
class Hedgelog
class Scrubber
def initialize(replacements = nil)
- @replacements = replacements || [
- ScrubReplacement.new('password', '**********')
- ]
+ @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
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))