"James Edward Gray II" <james / grayproductions.net> schrieb im Newsbeitrag
news:98E27FB2-2299-11D9-A2B6-000A95BA45F8 / grayproductions.net...
> On Oct 20, 2004, at 7:43 AM, Matt Maycock wrote:
>
> > a much better idea would be:
> >
> > DEFAULT_HASH = { ... }
> > def myFunc(arg1, ..., argN, optHash={})
> >   DEFAULT_HASH.keys.each {|k|
> >     optHash[k] = DEFAULT_HASH[k] unless optHash.include?(k)
> >   }
> >   ....
> > end
>
> Or slightly simpler:
>
> DEFAULT_OPTIONS = { ... }
> def my_func( arg1, ... argN, options = { } )
> options = DEFAULT_OPTIONS.merge(options)
>
> # ...
> end
>
> James Edward Gray II
>
>
>