Class: ToeTag::ProcSpec

Inherits:
ExceptionSpec show all
Defined in:
lib/toe_tag.rb

Overview

Wraps a proc to allow arbitrary logic when matching an exception.

Instance Method Summary collapse

Methods included from ExceptionBehavior

#with_message

Constructor Details

#initialize(blk, exception = StandardError) ⇒ ProcSpec

Returns a new instance of ProcSpec.



89
90
91
92
# File 'lib/toe_tag.rb', line 89

def initialize(blk, exception = StandardError)
  self.exception = exception
  self.block = blk
end

Instance Method Details

#===(except) ⇒ Object



94
95
96
# File 'lib/toe_tag.rb', line 94

def ===(except)
  exception === except && block[except]
end