summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions/values_at.rb
diff options
context:
space:
mode:
authorGlenn Sarti <glennsarti@users.noreply.github.com>2017-03-13 14:30:21 -0700
committerGitHub <noreply@github.com>2017-03-13 14:30:21 -0700
commite4ea1c46e7408f6878819dc08905be445a9c7bc8 (patch)
treeb0b388ca940fbc2771ef8fc07abf8af4af51a311 /lib/puppet/parser/functions/values_at.rb
parent46e3a2349e9eef4001db8be9581fae9dfbccaf14 (diff)
parente2a8690fa6a41e481ae14e9642f4f5efeaa2d681 (diff)
Merge pull request #729 from eputnam/i18n_prep
(MODULES-4473) join strings for i18n parser
Diffstat (limited to 'lib/puppet/parser/functions/values_at.rb')
-rw-r--r--lib/puppet/parser/functions/values_at.rb18
1 files changed, 6 insertions, 12 deletions
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