That is strange. According to the Pickaxe[1] (the online one at least;
I don’t have my 1.9 copy handy) the exception matching is supposed to
be done with kind_of?; and the source code[2] seems to bear that out.
Clearly StandardError.new(:hello).kind_of?(StandardError.new(:hello))
is not true; it raises a TypeError because the argument isn’t a class
or module.
begin
raise x
rescue y
puts “ok” # doesn’t get printed
end
That is strange. According to the Pickaxe[1] (the online one at least;
I don’t have my 1.9 copy handy) the exception matching is supposed to
be done with kind_of?; and the source code[2] seems to bear that out.
Clearly StandardError.new(:hello).kind_of?(StandardError.new(:hello))
is not true; it raises a TypeError because the argument isn’t a class
or module.