From f49eb6b8e20a8517916d984d1606daaabbba9a23 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Wed, 6 May 2015 10:13:27 +0100 Subject: range(): fix TypeError(can't convert nil into Integer) when using range syntax --- lib/puppet/parser/functions/range.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/puppet/parser/functions') diff --git a/lib/puppet/parser/functions/range.rb b/lib/puppet/parser/functions/range.rb index c14f6e6..2fc2113 100644 --- a/lib/puppet/parser/functions/range.rb +++ b/lib/puppet/parser/functions/range.rb @@ -47,7 +47,7 @@ Will return: [0,2,4,6,8] type = '..' # Use the simplest type of Range available in Ruby - else # arguments.size == 0 + else # arguments.size == 1 value = arguments[0] if m = value.match(/^(\w+)(\.\.\.?|\-)(\w+)$/) @@ -55,7 +55,7 @@ Will return: [0,2,4,6,8] stop = m[3] type = m[2] - + step = 1 elsif value.match(/^.+$/) raise(Puppet::ParseError, "range(): Unable to compute range " + "from the value: #{value}") @@ -78,7 +78,7 @@ Will return: [0,2,4,6,8] when '...' then (start ... stop) # Exclusive of last element end - result = range.step(step).collect { |i| i } + result = range.step(step).to_a return result end -- cgit v1.2.3