On Jun 25, 2007, at 9:04 PM, Frank Church wrote:

>
> If a ruby hash rubyhash has a key such as "hashkey" is there a way of
> retrieving the value by the expression rubyhash["hashkey"] ?
>
> It only seems logical that is rubyhash.has_key?("hashkey") returns  
> true
> rubyhash["hashkey"] should return a value, but it always gives an  
> error.
>
> I know the same can be achieved via with rubyhash.values_at("hashkey")
> but it appears so inelegant to me.

What you say you are doing works for me.

    rubyhash = { "hashkey" => "value"}
    rubyhash["hashkey"] # => "value"

I can only conclude that your problem is really other than what you  
think it is. I think you would be well advised to post the actual  
code that is producing the error.

Regards, Morton