I'm defining a simple class that extends Hash. The code below works. What I don't understand is why I can't replace
the line: "self[key] = key" with "[key] = key"? If I leave out the "self", I get a parse error. Why?
class Signature < Hash
def initialize(keyArray)
super()
for key in keyArray
self[key] = key
end
end
def each
each_key
end
end #class Signature