Module: Kernel
- Defined in:
- lib/core_ext/kernel.rb
Instance Method Summary collapse
Instance Method Details
#exceptions_matching(matcher) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/core_ext/kernel.rb', line 13 def exceptions_matching(matcher) m = Module.new (class << m; self; end).instance_eval do define_method(:===) do |err| err. =~ matcher end end m end |
#exceptions_wrapping(error_class) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/core_ext/kernel.rb', line 3 def exceptions_wrapping(error_class) m = Module.new (class << m; self; end).instance_eval do define_method(:===) do |err| err.respond_to?(:original_exception) && error_class === err.original_exception end end m end |