From: Tammo Freese Date: 2001-03-06T01:52:15+09:00 Subject: [ruby-talk:12043] using rescue/ensure in methods Hello, I found a strange behaviour. This works: class Test def test puts "Tested" myError = 4 / 0 rescue puts "Captured" ensure puts "Ensured" end end x = Test.new x.test But the following code class Test def Test.test puts "Tested" myError = 4 / 0 rescue puts "Captured" ensure puts "Ensured" end end Test.test does not compile: exceptiontest.rb:5: parse error exceptiontest.rb:7: parse error (ruby 1.6.2 (2000-12-18) [i386-cygwin]) Why does rescue/ensure in the body of the method does not work for class methods? Bug, feature or my fault? - Tammo Freese freese@acm.org