lib/hedgelog/scrubber.rb in hedgelog-0.2.0 vs lib/hedgelog/scrubber.rb in hedgelog-0.2.1.alpha1
- old
+ new
@@ -2,17 +2,15 @@
class Hedgelog
class Scrubber
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
+ replacements&.each do |x|
+ @replacements << if x.instance_of?(ScrubReplacement)
+ x
+ else
+ ScrubReplacement.new(x, '**********')
+ 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