> def my_method(arg1, arg2, *options)
> options = options.to_option_hash
> # ...
> end
That's pretty cool. I was thinking something similar, but got stuck on
naming the method :-p
The advantage of this strategy over args.include?(:flag) is that it's
backwards compatible with my_method(:flag => true, :config =>
"whatever"). Also, although I'm sure it's negligible, after you hash it
you have a seek time of O(1), whereas I assume you have a seek time of
O(n) every time you call include?(). But mostly the backwards
compatibility.
--
Posted via http://www.ruby-forum.com/.