Sha256: 9b8ae0fa6f7c3864f96bd97a5fabd5bc8214cf089d19b4afac026645c2575367
Contents?: true
Size: 810 Bytes
Versions: 17
Compression:
Stored size: 810 Bytes
Contents
require "forwardable" module Imap::Backup class Sanitizer extend Forwardable attr_reader :output delegate puts: :output delegate write: :output def initialize(output) @output = output @current = "" end def print(*args) @current << args.join loop do line, newline, rest = @current.partition("\n") break if newline != "\n" clean = sanitize(line) output.puts clean @current = rest end end def flush return if @current == "" clean = sanitize(@current) output.puts clean end private def sanitize(text) # Hide password in Net::IMAP debug output text.gsub( /\A(C: RUBY\d+ LOGIN \S+) \S+/, "\\1 [PASSWORD REDACTED]" ) end end end
Version data entries
17 entries across 17 versions & 1 rubygems