From 85470dfc1e703611a84abf922634d129dd2f8f8d Mon Sep 17 00:00:00 2001 From: varac Date: Tue, 27 Aug 2013 18:05:12 +0200 Subject: added obfuscate_email.rb, including 'obfuscate_email' function --- lib/puppet/parser/functions/obfuscate_email.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lib/puppet/parser/functions/obfuscate_email.rb (limited to 'lib/puppet') 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 -- cgit v1.2.3