我正在使用该方法mm
。在 ruby 1.9.2 中,它的行为很奇怪,而不是1.9.2=>10
我得到的预期结果
ELSE **
1.9.2=>8
知道发生了什么吗?
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"
使用 1.8.7 我得到了预期的结果:
1.8.7=>10