added obfuscate_email.rb, including 'obfuscate_email' function
authorvarac <varacanero@zeromail.org>
Tue, 27 Aug 2013 16:05:12 +0000 (18:05 +0200)
committervarac <varacanero@zeromail.org>
Tue, 27 Aug 2013 16:05:12 +0000 (18:05 +0200)
lib/puppet/parser/functions/obfuscate_email.rb [new file with mode: 0644]

diff --git a/lib/puppet/parser/functions/obfuscate_email.rb b/lib/puppet/parser/functions/obfuscate_email.rb
new file mode 100644 (file)
index 0000000..07ccf72
--- /dev/null
@@ -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