Class: ConfidentialInfoRedactorLite::Hyperlink
- Inherits:
-
Object
- Object
- ConfidentialInfoRedactorLite::Hyperlink
- Defined in:
- lib/confidential_info_redactor_lite/hyperlink.rb
Constant Summary collapse
- HYPERLINK_REGEX =
Rubular: rubular.com/r/fXa4lp0gfS
/(http|https|www)(\.|:)/
Instance Method Summary collapse
Instance Method Details
#replace(text) ⇒ Object
7 8 9 10 |
# File 'lib/confidential_info_redactor_lite/hyperlink.rb', line 7 def replace(text) text.split(/\s+/).map { |token| text = text.gsub(/#{Regexp.escape(token.gsub(/\.\z/, ''))}/, ' <redacted hyperlink> ') if !(token !~ HYPERLINK_REGEX) } text end |