특별한 경우에 NameError를 잡아야합니다. 그러나 NameError의 모든 하위 클래스를 포착하고 싶지는 않습니다. 이것을 달성 할 수있는 방법이 있습니까?Reseue NameError (NoMethodError 제외)
begin
# your code goes here
rescue NameError => exception
# note that `exception.kind_of?` will not work as expected here
raise unless exception.class.eql?(NameError)
# handle `NameError` exception here
end
이 솔루션은 내 필요에 맞습니다. – PascalTurbo