From e2a8690fa6a41e481ae14e9642f4f5efeaa2d681 Mon Sep 17 00:00:00 2001 From: Eric Putnam Date: Tue, 28 Feb 2017 15:31:36 -0800 Subject: (MODULES-4473) join strings for i18n parser This commit joins all strings that are split over two lines with a plus, backslash, or double less than so that our magical i18n parser can wave over the module and mark every ruby string with our i18n function. --- lib/puppet/parser/functions/values_at.rb | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'lib/puppet/parser/functions/values_at.rb') diff --git a/lib/puppet/parser/functions/values_at.rb b/lib/puppet/parser/functions/values_at.rb index f350f53..04a3d1a 100644 --- a/lib/puppet/parser/functions/values_at.rb +++ b/lib/puppet/parser/functions/values_at.rb @@ -29,8 +29,7 @@ Would return ['a','c','d']. EOS ) do |arguments| - raise(Puppet::ParseError, "values_at(): Wrong number of " + - "arguments given (#{arguments.size} for 2)") if arguments.size < 2 + raise(Puppet::ParseError, "values_at(): Wrong number of arguments given (#{arguments.size} for 2)") if arguments.size < 2 array = arguments.shift @@ -41,8 +40,7 @@ Would return ['a','c','d']. indices = [arguments.shift].flatten() # Get them all ... Pokemon ... if not indices or indices.empty? - raise(Puppet::ParseError, 'values_at(): You must provide ' + - 'at least one positive index to collect') + raise(Puppet::ParseError, 'values_at(): You must provide at least one positive index to collect') end result = [] @@ -57,11 +55,9 @@ Would return ['a','c','d']. type = m[2] if start > stop - raise(Puppet::ParseError, 'values_at(): Stop index in ' + - 'given indices range is smaller than the start index') + raise(Puppet::ParseError, 'values_at(): Stop index in given indices range is smaller than the start index') elsif stop > array.size - 1 # First element is at index 0 is it not? - raise(Puppet::ParseError, 'values_at(): Stop index in ' + - 'given indices range exceeds array size') + raise(Puppet::ParseError, 'values_at(): Stop index in given indices range exceeds array size') end range = case type @@ -73,16 +69,14 @@ Would return ['a','c','d']. else # Only positive numbers allowed in this case ... if not i.match(/^\d+$/) - raise(Puppet::ParseError, 'values_at(): Unknown format ' + - 'of given index') + raise(Puppet::ParseError, 'values_at(): Unknown format of given index') end # In Puppet numbers are often string-encoded ... i = i.to_i if i > array.size - 1 # Same story. First element is at index 0 ... - raise(Puppet::ParseError, 'values_at(): Given index ' + - 'exceeds array size') + raise(Puppet::ParseError, 'values_at(): Given index exceeds array size') end indices_list << i -- cgit v1.2.3