Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/classified-ipsum.rb
Constant Summary collapse
- DEFAULT_REDACTION =
'[REDACTED]'
- DEFAULT_SANITIZATION =
'█'
Instance Method Summary collapse
-
#redact ⇒ Object
Returns the redacted string e.g.
-
#sanitize ⇒ Object
Returns the redacted string e.g.
Instance Method Details
#redact ⇒ Object
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 |
#sanitize ⇒ Object
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 |