diff options
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/parser/functions/obfuscate_email.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/puppet/parser/functions/obfuscate_email.rb b/lib/puppet/parser/functions/obfuscate_email.rb index 07ccf72..4e4cb82 100644 --- a/lib/puppet/parser/functions/obfuscate_email.rb +++ b/lib/puppet/parser/functions/obfuscate_email.rb @@ -1,17 +1,15 @@ module Puppet::Parser::Functions newfunction(:obfuscate_email, :type => :rvalue, :doc => <<-EOS Given: - an email in form of john@doe.com + a comma seperated email string in form of 'john@doe.com, doe@john.com' -This function will return an obfuscated email in form of 'john {at} doe {dot} com' +This function will return all emails obfuscated in form of 'john {at} doe {dot} com, doe {at} john {dot} com' +Works with multiple email adresses as well as with a single email adress. EOS ) do |args| - email=args[0] - email["@"]= " {at} " - email=email.gsub(/(.*)(\.)(.*)/, '\1 {dot} \3') - email - end + args[0].gsub('@', ' {at} ').gsub('.', ' {dot} ') + end end # vim: set ts=2 sw=2 et : |