Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/classified-ipsum.rb

Constant Summary collapse

DEFAULT_REDACTION =
'[REDACTED]'
DEFAULT_SANITIZATION =
''

Instance Method Summary collapse

Instance Method Details

#redactObject

Returns the redacted string e.g. “Lee Reilly” becomes “███ ██████”



9
10
11
# File 'lib/classified-ipsum.rb', line 9

def redact
  ("#{DEFAULT_REDACTION} " * self.split(" ").size).strip
end

#sanitizeObject

Returns the redacted string e.g. “Lee Reilly” becomes “[REDACTED] [REDACTED]”“



15
16
17
# File 'lib/classified-ipsum.rb', line 15

def sanitize
  self.downcase.gsub(/[abcdefghijklmnopqrstuvwxyz1234567890]/, DEFAULT_SANITIZATION)
end