Sha256: f5f083f067b0d25a7805a09b764bb58524bf504c95e26621d8c2fa958871f8f8

Contents?: true

Size: 572 Bytes

Versions: 1

Compression:

Stored size: 572 Bytes

Contents

require 'hedgelog/scrub_replacement'

class Hedgelog
  class Scrubber
    def initialize(replacements = nil)
      @replacements = replacements || [
        ScrubReplacement.new('password', '**********')
      ]
    end

    # rubocop:disable Security/MarshalLoad
    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
    # rubocop:enable Security/MarshalLoad
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hedgelog-0.1.9 lib/hedgelog/scrubber.rb