summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Barber <ken@bob.sh>2011-07-30 00:44:02 +0100
committerKen Barber <ken@bob.sh>2011-07-30 00:44:02 +0100
commit35fefe186546427963d8c8a446fa98875d65ccad (patch)
tree9986ea2c264ce50c35f856218c8d26bb8c6872bd
parenta1cae426f1d6b8f2c19184ec8aac3ebc47d97744 (diff)
downloadpuppet-stdlib-35fefe186546427963d8c8a446fa98875d65ccad.tar.gz
puppet-stdlib-35fefe186546427963d8c8a446fa98875d65ccad.tar.bz2
Fix some ruby 1.9.2 issues.
-rw-r--r--lib/puppet/parser/functions/sort.rb2
-rw-r--r--lib/puppet/parser/functions/values_at.rb2
-rw-r--r--spec/unit/parser/functions/shuffle_spec.rb2
3 files changed, 3 insertions, 3 deletions
diff --git a/lib/puppet/parser/functions/sort.rb b/lib/puppet/parser/functions/sort.rb
index 3785496..cefbe54 100644
--- a/lib/puppet/parser/functions/sort.rb
+++ b/lib/puppet/parser/functions/sort.rb
@@ -18,7 +18,7 @@ Sorts strings and arrays lexically.
if value.is_a?(Array) then
value.sort
elsif value.is_a?(String) then
- value.split("").sort.to_s
+ value.split("").sort.join("")
end
end
diff --git a/lib/puppet/parser/functions/values_at.rb b/lib/puppet/parser/functions/values_at.rb
index 7f1de8e..d3e69d9 100644
--- a/lib/puppet/parser/functions/values_at.rb
+++ b/lib/puppet/parser/functions/values_at.rb
@@ -38,7 +38,7 @@ Would return ['a','c','d'].
raise(Puppet::ParseError, 'values_at(): Requires array to work with')
end
- indices = *arguments # Get them all ... Pokemon ...
+ indices = [arguments.shift].flatten() # Get them all ... Pokemon ...
if not indices or indices.empty?
raise(Puppet::ParseError, 'values_at(): You must provide ' +
diff --git a/spec/unit/parser/functions/shuffle_spec.rb b/spec/unit/parser/functions/shuffle_spec.rb
index 936c2fd..f04fda5 100644
--- a/spec/unit/parser/functions/shuffle_spec.rb
+++ b/spec/unit/parser/functions/shuffle_spec.rb
@@ -25,7 +25,7 @@ describe "the shuffle function" do
it "should shuffle a string but the sorted contents should still be the same" do
result = @scope.function_shuffle(["adfs"])
- result.split("").sort.to_s.should(eq("adfs"))
+ result.split("").sort.join("").should(eq("adfs"))
end
end