2008/3/12, Max Williams <toastkid.williams / gmail.com>:
> I'm using the method of parameter passing where i have one 'regular'
>  parameter and then a hash of options:
>
>  def chunkify(something, options = {})
>   ...
>  end
>
>  I want to have it so that the user can just pass a key through without
>  having to set it to anything, eg
>
>  dinner = chunkify(bacon, :extra_fine)
>
>  However, 'extra_fine' is just being treated as a symbol, rather than a
>  hash key, and so 'options' is simply the symbol :extra_fine, rather than
>  the hash {:extra_fine => nil}.
>
>  I can fix this by passing :extra_fine => true to the method, but can i
>  set up the method so it will just take the hash key, and maybe some
>  other hash_keys, some with and some without values?

Nope.  You will have to use chunkify(something, *options) and do the
processing yourself.  Note that in no case can you mix Hash entries
with and without values.  But you can do

irb(main):006:0> def x(*a)p a end
=> nil
irb(main):007:0> x(:foo, :bar => 2)
[:foo, {:bar=>2}]
=> nil
irb(main):008:0>

Kind regards

robert

-- 
use.inject do |as, often| as.you_can - without end