Sha256: 2fb18961fab10eb9e66f4396f75d2d08491b3da2f372bd51d6bc5c4cbddbe5be

Contents?: true

Size: 472 Bytes

Versions: 1

Compression:

Stored size: 472 Bytes

Contents

# encoding: utf-8
class String

  DEFAULT_REDACTION    = '[REDACTED]'
  DEFAULT_SANITIZATION = '█'

  # Returns the redacted string e.g.
  # "Lee Reilly" becomes "███ ██████"
  def redact
    ("#{DEFAULT_REDACTION} " * self.split(" ").size).strip
  end

  # Returns the redacted string e.g.
  # "Lee Reilly" becomes "[REDACTED] [REDACTED]""
  def sanitize
    self.downcase.gsub(/[abcdefghijklmnopqrstuvwxyz1234567890]/, DEFAULT_SANITIZATION)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
classified-ipsum-0.1.0 lib/classified-ipsum.rb