il Tue, 15 Jun 2004 00:17:55 +0900, Ben Giddings
<bg-rubytalk / infofiend.com> ha scritto::


>I think the best way to get the behaviour you want is to use a hash. 
>Instead of assigning the value to a variable, you just assign the value 
>to a hash key.
>
>$h = Hash.new
>
>def test_key(sym)
>   if $h.has_key?(sym)
>     ...
>   else
>     ...
>   end
>end
>

hey, accesing globals from a method is ugly, just use a singleton :)

H=Hash.new

def H.test_key sym
 if has_key? sym
  ...
 else
  ...
 end
end