summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions/obfuscate_email.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/functions/obfuscate_email.rb')
-rw-r--r--lib/puppet/parser/functions/obfuscate_email.rb16
1 files changed, 16 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..4e4cb82
--- /dev/null
+++ b/lib/puppet/parser/functions/obfuscate_email.rb
@@ -0,0 +1,16 @@
+module Puppet::Parser::Functions
+ newfunction(:obfuscate_email, :type => :rvalue, :doc => <<-EOS
+Given:
+ a comma seperated email string in form of 'john@doe.com, doe@john.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|
+ args[0].gsub('@', ' {at} ').gsub('.', ' {dot} ')
+ end
+end
+
+# vim: set ts=2 sw=2 et :
+# encoding: utf-8