On Tue, 22 Nov 2005, Stefan Kaes wrote:

> URABE Shyouhei wrote:
>
>> 
>> On 22 Nov 2005, at 15:57, Stefan Kaes wrote:
>> 
>>> This doesn't solve the problem of accessing the hash twice and computing 
>>> the hash of the lookup key twice. And it's even more text than before.
>> 
>> 
>> f(options.fetch(:x){raise}) rescue nil
>> 
>> Don't know if it's elegant though
>> 
>> 
>> 
> Neither elegant nor efficient. And don't ask me whether it's intuitive or 
> understandable.

i use this

   harp:~ > cat a.rb
   options = {:x => 42}
   alias f puts

   x = options[:x] and f x

   harp:~ > ruby a.rb
   42

-a
-- 
===============================================================================
| ara [dot] t [dot] howard [at] gmail [dot] com
| all happiness comes from the desire for others to be happy.  all misery
| comes from the desire for oneself to be happy.
| -- bodhicaryavatara
===============================================================================