From: mike leonard Date: 2008-03-09T08:34:57+09:00 Subject: A question on singleton methods Hello, I have a hash full of objects, like so: a_hash = { :a => "alpha", :b => "beta" } I don't I need to define a singleton method for one of the items in the class. I thought I could do: def a_hash.fetch(:a).to_s "ALPHA" end But all this gets me is a big fat error: t.rb:2: syntax error, unexpected tSYMBEG, expecting ')' def a_hash.fetch(:a).to_s ^ This is just a minimal example. In real life, the objects in the hash have been generated programatically, so I don't have variable references for them -- just the keys. Is it possible that there is a way around this error? If not, is there another way to do what I'm trying to do? I'm pretty new to this, so apologies in advance if it is an obvious mistake. Thank you, Mike Leonard