Is this a bug in ruby?
class Foo
def intialize(aVal,bVal)
@aVal=aVal
@bVal=bVal
end
def ack
yield(@aVal,@bVal)
end
end
foo[0]=Foo.new("ack","ack")
foo[1]=Foo.new("bar","bar")
foo[2]=Foo.new("foo","foo")
foo.each { |aVal| puts aVal }
Produces:
ack
ack
bar
bar
foo
foo
It seems the output should be:
ack
bar
foo