summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/functions/sprintf.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-02-13 18:24:34 -0600
committerLuke Kanies <luke@madstop.com>2009-02-13 18:24:34 -0600
commit3fbec120768d84d208b14f574dfe916e25cfdbef (patch)
tree865d59f4ea9cf3782db46ce1ae7fd54b95945035 /lib/puppet/parser/functions/sprintf.rb
parenta2270b4a4f093c6c4f171dcf0c0e05fe101dd979 (diff)
parent2561c8e252dcf66890513458750bb1329a03beec (diff)
downloadpuppet-3fbec120768d84d208b14f574dfe916e25cfdbef.tar.gz
puppet-3fbec120768d84d208b14f574dfe916e25cfdbef.tar.xz
puppet-3fbec120768d84d208b14f574dfe916e25cfdbef.zip
Merge branch '0.24.x'
Conflicts: lib/puppet/indirector/facts/facter.rb lib/puppet/provider/augeas/augeas.rb lib/puppet/util/filetype.rb spec/unit/indirector/facts/facter.rb spec/unit/provider/augeas/augeas.rb test/util/filetype.rb
Diffstat (limited to 'lib/puppet/parser/functions/sprintf.rb')
-rw-r--r--lib/puppet/parser/functions/sprintf.rb17
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