Sha256: d4ce078501df164d1150af0b41945db907a17f2a3dce84911f3da4d23dbd73d8

Contents?: true

Size: 486 Bytes

Versions: 5

Compression:

Stored size: 486 Bytes

Contents

require 'hedgelog/scrub_replacement'

class Hedgelog
  class Scrubber
    def initialize(replacements = nil)
      @replacements = replacements || [
        ScrubReplacement.new('pasword', '**********')
      ]
    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))
      @replacements.each do |r|
        r.scrub_hash(d)
      end
      d
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hedgelog-0.1.4 lib/hedgelog/scrubber.rb
hedgelog-0.1.3 lib/hedgelog/scrubber.rb
hedgelog-0.1.2 lib/hedgelog/scrubber.rb
hedgelog-0.1.1 lib/hedgelog/scrubber.rb
hedgelog-0.1.0 lib/hedgelog/scrubber.rb