diff options
author | Ian Taylor <ian@lorf.org> | 2009-06-05 12:38:35 -0400 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-06-06 09:11:28 +1000 |
commit | 41ce18cc8ea239d1633fc6cd9e9f599957a82e74 (patch) | |
tree | 9d398b4e3e6d726a174b5b57094c7dd6749ccf0e /lib/puppet/parser | |
parent | f3b40923605420f774dac298fb1708de180c0a81 (diff) | |
download | puppet-41ce18cc8ea239d1633fc6cd9e9f599957a82e74.tar.gz puppet-41ce18cc8ea239d1633fc6cd9e9f599957a82e74.tar.xz puppet-41ce18cc8ea239d1633fc6cd9e9f599957a82e74.zip |
Changed tabs to spaces without interfering with indentation or alignment
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r-- | lib/puppet/parser/functions/regsubst.rb | 64 | ||||
-rw-r--r-- | lib/puppet/parser/functions/sprintf.rb | 12 |
2 files changed, 38 insertions, 38 deletions
diff --git a/lib/puppet/parser/functions/regsubst.rb b/lib/puppet/parser/functions/regsubst.rb index 2bd39200d..8a1a244ab 100644 --- a/lib/puppet/parser/functions/regsubst.rb +++ b/lib/puppet/parser/functions/regsubst.rb @@ -1,6 +1,6 @@ module Puppet::Parser::Functions newfunction(:regsubst, :type => :rvalue, - :doc => " + :doc => " Perform regexp replacement on a string. - **Parameters** (in order): @@ -36,36 +36,36 @@ Put angle brackets around each octet in the node's IP address:: $x = regsubst($ipaddress, '([0-9]+)', '<\\1>', 'G') ") \ do |args| - flag_mapping = { - "E" => Regexp::EXTENDED, - "I" => Regexp::IGNORECASE, - "M" => Regexp::MULTILINE, - } - if args.length < 3 or args.length > 5 - raise Puppet::ParseError, ("regsub(): wrong number of arguments" + - " (#{args.length}; min 3, max 5)") - end - str, regexp, replacement, flags, lang = args - reflags = 0 - global = false - (flags or "").each_byte do |f| - f = f.chr - if f == "G" - global = true - else - fvalue = flag_mapping[f] - if !fvalue - raise Puppet::ParseError, "regsub(): bad flag `#{f}'" - end - reflags |= fvalue - end - end - re = Regexp.compile(regexp, reflags, lang) - if global - result = str.gsub(re, replacement) - else - result = str.sub(re, replacement) - end - return result + flag_mapping = { + "E" => Regexp::EXTENDED, + "I" => Regexp::IGNORECASE, + "M" => Regexp::MULTILINE, + } + if args.length < 3 or args.length > 5 + raise Puppet::ParseError, ("regsub(): wrong number of arguments" + + " (#{args.length}; min 3, max 5)") + end + str, regexp, replacement, flags, lang = args + reflags = 0 + global = false + (flags or "").each_byte do |f| + f = f.chr + if f == "G" + global = true + else + fvalue = flag_mapping[f] + if !fvalue + raise Puppet::ParseError, "regsub(): bad flag `#{f}'" + end + reflags |= fvalue + end + end + re = Regexp.compile(regexp, reflags, lang) + if global + result = str.gsub(re, replacement) + else + result = str.sub(re, replacement) + end + return result end end diff --git a/lib/puppet/parser/functions/sprintf.rb b/lib/puppet/parser/functions/sprintf.rb index f6daeff49..d84b1866a 100644 --- a/lib/puppet/parser/functions/sprintf.rb +++ b/lib/puppet/parser/functions/sprintf.rb @@ -1,12 +1,12 @@ module Puppet::Parser::Functions newfunction(:sprintf, :type => :rvalue, - :doc => "Perform printf-style formatting of text. + :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) + if args.length < 1 + raise Puppet::ParseError, 'sprintf() needs at least one argument' + end + fmt = args.shift() + return sprintf(fmt, *args) end end |