Class: ConfidentialInfoRedactorLite::Hyperlink

Inherits:
Object
  • Object
show all
Defined in:
lib/confidential_info_redactor_lite/hyperlink.rb

Constant Summary collapse

/(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