Sha256: dea133dee020b75045286995a9fa421809089289b3a120b4c588bec50d00bf8b
Contents?: true
Size: 744 Bytes
Versions: 22
Compression:
Stored size: 744 Bytes
Contents
require "forwardable" 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
Version data entries
22 entries across 22 versions & 1 rubygems