diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/parser/functions/obfuscate_email.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/obfuscate_email.rb b/lib/puppet/parser/functions/obfuscate_email.rb new file mode 100644 index 0000000..07ccf72 --- /dev/null +++ b/lib/puppet/parser/functions/obfuscate_email.rb @@ -0,0 +1,18 @@ +module Puppet::Parser::Functions + newfunction(:obfuscate_email, :type => :rvalue, :doc => <<-EOS +Given: + an email in form of john@doe.com + +This function will return an obfuscated email in form of 'john {at} doe {dot} com' + + EOS + ) do |args| + email=args[0] + email["@"]= " {at} " + email=email.gsub(/(.*)(\.)(.*)/, '\1 {dot} \3') + email + end +end + +# vim: set ts=2 sw=2 et : +# encoding: utf-8 |