Class: Anon::Text
Overview
Anonymises any detected e-mail address in a text stream
Constant Summary collapse
- EMAIL_REGEX =
From the email regex research: fightingforalostcause.net/misc/2006/compare-email-regex.php Authors: James Watts and Francisco Jose Martin Moreno
/([\w\!\#\z\%\&\'\*\+\-\/\=\?\\A\`{\|\}\~]+\.)*[\w\+-]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)/i
Instance Method Summary collapse
-
#anonymise! ⇒ Object
Anonymises any e-mail addresses found in the text.
-
#initialize(input, output) ⇒ Text
constructor
Returns a new instance of the Text anonymiser.
Methods inherited from Base
Constructor Details
#initialize(input, output) ⇒ Text
Returns a new instance of the Text anonymiser
15 16 17 18 |
# File 'lib/anon/text.rb', line 15 def initialize(input, output) @input = input @output = output end |
Instance Method Details
#anonymise! ⇒ Object
Anonymises any e-mail addresses found in the text
21 22 23 24 25 26 27 28 29 |
# File 'lib/anon/text.rb', line 21 def anonymise! start_progress map_lines do |line| line = anonymise_line(line) increment_progress line end complete_progress end |