summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions
diff options
context:
space:
mode:
authorHunter Haugen <hunter@puppetlabs.com>2014-11-13 10:16:21 -0800
committerHunter Haugen <hunter@puppetlabs.com>2014-11-13 10:16:21 -0800
commitb6830f1ade27bf1dad9c75d45ee21cebcddf11f6 (patch)
treecd9a343bebe0f752b34c835c31dfa91ddabc7bd8 /lib/puppet/parser/functions
parentb80c432ab9de2536aab099e5d5b3baf9e883bc68 (diff)
parentaf0a2779cb63b09a07f675ede3ae0b959c7442f6 (diff)
downloadpuppet-stdlib-b6830f1ade27bf1dad9c75d45ee21cebcddf11f6.tar.gz
puppet-stdlib-b6830f1ade27bf1dad9c75d45ee21cebcddf11f6.tar.bz2
Merge pull request #365 from dalen/range-integers
Make the range function work with integers
Diffstat (limited to 'lib/puppet/parser/functions')
-rw-r--r--lib/puppet/parser/functions/range.rb26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/puppet/parser/functions/range.rb b/lib/puppet/parser/functions/range.rb
index ffbdf84..49fba21 100644
--- a/lib/puppet/parser/functions/range.rb
+++ b/lib/puppet/parser/functions/range.rb
@@ -65,21 +65,21 @@ Will return: [0,2,4,6,8]
end
end
- # Check whether we have integer value if so then make it so ...
- if start.match(/^\d+$/)
- start = start.to_i
- stop = stop.to_i
- else
- start = start.to_s
- stop = stop.to_s
- end
+ # Check whether we have integer value if so then make it so ...
+ if start.to_s.match(/^\d+$/)
+ start = start.to_i
+ stop = stop.to_i
+ else
+ start = start.to_s
+ stop = stop.to_s
+ end
- range = case type
- when /^(\.\.|\-)$/ then (start .. stop)
- when /^(\.\.\.)$/ then (start ... stop) # Exclusive of last element ...
- end
+ range = case type
+ when /^(\.\.|\-)$/ then (start .. stop)
+ when /^(\.\.\.)$/ then (start ... stop) # Exclusive of last element ...
+ end
- result = range.step(step).collect { |i| i } # Get them all ... Pokemon ...
+ result = range.step(step).collect { |i| i } # Get them all ... Pokemon ...
return result
end