Sha256: 15c42734676c502f409e5c46c421152f6405b92d10286cbdcf365c48a4876294
Contents?: true
Size: 854 Bytes
Versions: 4
Compression:
Stored size: 854 Bytes
Contents
require "forwardable" module Imap; end module Imap::Backup module Text; end class Text::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
4 entries across 4 versions & 1 rubygems