diff options
author | James Turnbull <james@lovedthanlost.net> | 2009-02-14 02:11:21 +1100 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-02-14 02:11:21 +1100 |
commit | 1bc7404f5e3efa633bb0a5cf10828071cfc4d876 (patch) | |
tree | 97a71a66d524a8d934552cd95ec4f229b6183e0d /lib | |
parent | 336b6458a2264c550adf8e6799162380822e0d97 (diff) | |
download | puppet-1bc7404f5e3efa633bb0a5cf10828071cfc4d876.tar.gz puppet-1bc7404f5e3efa633bb0a5cf10828071cfc4d876.tar.xz puppet-1bc7404f5e3efa633bb0a5cf10828071cfc4d876.zip |
Fixed #1831 - Added sprintf function
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/parser/functions/sprintf.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/sprintf.rb b/lib/puppet/parser/functions/sprintf.rb new file mode 100644 index 000000000..79744104d --- /dev/null +++ b/lib/puppet/parser/functions/sprintf.rb @@ -0,0 +1,17 @@ +module Puppet::Parser::Functions + newfunction(:sprintf, :type => :rvalue, + :doc => "\ + Perform printf-style formatting of text. + + The first parameter is format string describing how the rest of the + parameters should be formatted. See the documentation for the + ``Kernel::sprintf()`` function in Ruby for all the details. + ") \ + do |args| + if args.length < 1 + raise Puppet::ParseError, 'sprintf() needs at least one argument' + end + fmt = args.shift() + return sprintf(fmt, *args) + end +end |