Module: Test::Unit::ExceptionHandler::ClassMethods
- Defined in:
- lib/test/unit/exception-handler.rb
Instance Method Summary collapse
-
#exception_handler(*method_name_or_handlers, &block) ⇒ Object
This is a public API for developers who extend test-unit.
- #exception_handlers ⇒ Object
- #unregister_exception_handler(*method_name_or_handlers) ⇒ Object
Instance Method Details
#exception_handler(method_name) ⇒ void #exception_handler {|test, exception| ... } ⇒ void
This is a public API for developers who extend test-unit.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/test/unit/exception-handler.rb', line 52 def exception_handler(*method_name_or_handlers, &block) if block_given? exception_handlers.unshift(block) else method_name_or_handlers.each do |method_name_or_handler| if method_name_or_handler.respond_to?(:call) handler = method_name_or_handler exception_handlers.unshift(handler) else method_name = method_name_or_handler attribute(:exception_handler, true, {}, method_name) end end end end |
#exception_handlers ⇒ Object
25 26 27 |
# File 'lib/test/unit/exception-handler.rb', line 25 def exception_handlers ExceptionHandler.exception_handlers end |
#unregister_exception_handler(*method_name_or_handlers) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/test/unit/exception-handler.rb', line 68 def unregister_exception_handler(*method_name_or_handlers) method_name_or_handlers.each do |method_name_or_handler| if method_name_or_handler.respond_to?(:call) handler = method_name_or_handler exception_handlers.delete(handler) else method_name = method_name_or_handler attribute(:exception_handler, false, {}, method_name) end end end |