> 
> There's also no such thing as a hash key that isn't part of a hash. It
> sounds like what you want to do is pass multiple objects to your
> method and create a hash from them inside the method.
> 
> 
> David

Hi David

I know what you're saying, it is a bit clumsy.

Where i'm coming from is that i often use a lot of options that are set 
to true by the user of the method if they want to use them, which does 
work nicely due to options[:foo] evaluating to nil if the user didn't 
set it, allowing me to have tests like
  if options[:foo] #missing key equivalent to :foo => false
    do_extra_stuff
  end

I just thought it would be even nicer to have the user just be able to 
pass the hash key, rather than have to keep adding "=> true".  So the 
presence of a hash key acts like a switch which i can test with

  if options.has_key? :foo
    do_extra_stuff
  end

I thought i'd seen this functionality in rails, where we can pass just a 
hash key without bothering to set it, if we want to switch something on 
or off.
-- 
Posted via http://www.ruby-forum.com/.