module Rubymisc::Exceptional
Public Instance Methods
errors_with_message(pattern)
click to toggle source
@example
begin raise 'Timeout socket' rescue errors_with_message /socket/ p 'socket E' end
# File lib/rubymisc/exceptional.rb, line 13 def errors_with_message(pattern) m = Module.new (class << m; self; end).instance_eval do define_method(:===) { |e| pattern === e.message } end m end