summaryrefslogtreecommitdiffstats
path: root/lib/puppet/rails/rails_resource.rb
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-04-19 20:23:27 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-04-20 13:32:09 -0700
commit5d7ef5caf30a0c5b3253340c5f2722e51c56c75e (patch)
tree6adfd56302755cc8d05e8a4287d011496241c75e /lib/puppet/rails/rails_resource.rb
parent33b5580ef6b6c851beb6852e56659afea8bb0b04 (diff)
downloadpuppet-5d7ef5caf30a0c5b3253340c5f2722e51c56c75e.tar.gz
puppet-5d7ef5caf30a0c5b3253340c5f2722e51c56c75e.tar.xz
puppet-5d7ef5caf30a0c5b3253340c5f2722e51c56c75e.zip
(#7062) better argument handling in the action wrapper methods
We previously used *args to collect all arguments to the action when_invoked block, then tried vaguely to massage some little bits of them into the right shape. Methods defined with blocks, in Ruby 1.8, also have some fun behaviours. The most special is that if you pass more than one argument to a block defined with only one Ruby will automatically coerce the arguments into an array – and this is preserved when it is bound to a method. This led to routine situations where we would pass the wrong number of arguments to the block because, say, the user gave an extra argument on the command line. Instead of failing this would transmogrify the arguments in counterintuitive ways, and end up with horrible stack traces when that interacted badly with the code as written. Now, instead, we work out the right argument format based on the arguments that the when_invoked block takes. This gives much better (albeit perhaps not so user friendly) behaviour at the interface level. Which is, at least, consistent with other Ruby API. Reviewed-By: Max Martin <max@puppetlabs.com>
Diffstat (limited to 'lib/puppet/rails/rails_resource.rb')
0 files changed, 0 insertions, 0 deletions