On Mon, Apr 5, 2010 at 4:09 PM, James Cammarata <[email protected]> wrote:
>
> On Tue, 6 Apr 2010 18:01:36 -0700, Paul Lathrop <[email protected]>
> wrote:
>> I wouldn't ask, but I'm not sure how to Google this specific type of
>> question.
>>
>> I'm looking at lib/puppet/util.rb at the execute function. The
>> function definition looks like:
>>
>> def execute(command, arguments = {:failonfail => true, :combine =>
>> true})
>>
>> What's going on there with that arguments = {} stuff? I've never
>> encountered this before.
>>
>> Hints appreciated :-D
>>
>> --Paul
>
> They're named arguments, here's a site I found useful for explaining it:
>
> http://saaientist.blogspot.com/2007/11/named-arguments-in-ruby.html
Hrm, okay, but that site seems to suggest that this line shouldn't work:
"The following code snippet almost works, but not quite...
class MyClass
def initialize(options = {:name => 'unknown', :size => 0})"
That function definition looks exactly like what we see here:
def execute(command, arguments = {:failonfail => true, :combine => true})
why do we expect it to work here?
--Paul
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.