Re passing blocks: thanks. Got that part working.
But about the other, I probably need to clarify a bit. The example in the doc was the following:
def a
print "Function 'a' called\n"
99
end for i in 1..2
if i == 2
print "a=", a, "\n"
else
a = 1
print "a=", a, "\n"
end
end
Which prints:
a=1
Function 'a' called
a=99
Frankly, I think that's perverse, and object-orientation won't save you. What if, instead of printing, you'd tried to call "a.blah"? Presumably you'd get the same sort of bizarre results.
/s