puppetlabs/puppet — pull request #1649 by richardc (2013-05-15 13:47:30+00:00)
Title: (#17871) fix nagios types uniqness under ruby 1.9

In ruby 1.8 and earlier, splatting a 1-element array would return the first
element, post 1.9 you always get an array back.

This lead to an issue in the nagios providers where the parameters['name']
would be set to an Array, so simple 'does this resource already exist
checks' would fail as parameters['name'] == string is false.

$ ruby-1.8.7-p371 -e 'a = ["a"]; b = *a; puts b.inspect'
"a"

$ ruby-1.9.3-p429 -e 'a = ["a"]; b = *a; puts b.inspect'
["a"]

This patch forces a destucturing assignment in method_missing by adding a comma
to the LHS. This is portable between ruby 1.8 and 1.9.

$ ruby-1.8.7-p371 -e 'a = ["a"]; b, = *a; puts b.inspect'
"a"

$ ruby-1.9.3-p429 -e 'a = ["a"]; b, = *a; puts b.inspect'
"a"