summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util/rdoc/code_objects.rb
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-04-01 10:48:07 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-04-04 13:32:04 -0700
commit4d23d60fc331220418d4502930bd2fad7ee44b84 (patch)
tree3de4c31dcf87bdd374cd1bcaaf596fdcb6f2609e /lib/puppet/util/rdoc/code_objects.rb
parenteb4c4fbdc3951c220a76ec01abc33a7654d89e53 (diff)
downloadpuppet-4d23d60fc331220418d4502930bd2fad7ee44b84.tar.gz
puppet-4d23d60fc331220418d4502930bd2fad7ee44b84.tar.xz
puppet-4d23d60fc331220418d4502930bd2fad7ee44b84.zip
(#6749) add a shim around the action implementation.
To present a pleasant Ruby API to folks invoking actions we want to have default values for the trailing 'options' argument, and to be able to pass a block to the code to allow yield to work. Given limitations of Ruby 1.8 regarding blocks, we can't use either of those because the block slot is bound at declaration time, and you can't give optional arguments. To work around this we inject, using eval, a full regular Ruby method into the final block of code. This can provide the default argument at the end in an intelligent way (albeit by emulating what the interpreter would do). This doesn't solve the yield problem, but the same method can pass the block explicitly, and allows other hooks to be injected, which makes it easier to do smarter things in future... Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
Diffstat (limited to 'lib/puppet/util/rdoc/code_objects.rb')
0 files changed, 0 insertions, 0 deletions