I am working with t开发者_JAVA技巧he method mm
. In ruby 1.9.2 it behaves weird, instead of the expected result 1.9.2=>10
I am getting
ELSE **
1.9.2=>8
Any idea of what is going on?
class A
def mm(data)
begin
send_len = data
return send_len
rescue Exception
STDOUT.write("Rescue *#{$!}*\n")
else
STDOUT.write("ELSE *#{$!}*\n")
end
end
end # class A
a = A.new
print "#{RUBY_VERSION}=>#{a.mm(10)}\n"
With 1.8.7 I get the expected result:
1.8.7=>10
It's an open bug in Ruby. There is a discussion, though, whether it should behave like it behaved in 1.8 or as it does in 1.9.
Matz, the author of Ruby, believes that it should behave as in 1.8.
精彩评论