class A attr_accessor :check_errors def initialize @check_errors = Proc.new do |something| return something if something.kind_of? Exception if something.respond_to? :each bad = something.detect { |thing| thing.kind_of? Exception } return bad if bad end end end end class B < A def maybe_erronous # do stuff... self.check_errors(questionable) # do more stuff... end end
Except the code would actually work. If you define a Proc like that it raises a LocalJumpError exception.
Then I remembered I could just re-raise the exception and catch it in the calling code. Duh.