Class: Adrian::FailureHandler::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/adrian/failure_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exception_class, block) ⇒ Rule

Returns a new instance of Rule.



22
23
24
25
# File 'lib/adrian/failure_handler.rb', line 22

def initialize(exception_class, block)
  @exception_class = exception_class
  @block           = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



20
21
22
# File 'lib/adrian/failure_handler.rb', line 20

def block
  @block
end

Instance Method Details

#match(exception) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/adrian/failure_handler.rb', line 27

def match(exception)
  return @exception_class.nil? if exception.nil?

  return false if @exception_class.nil?

  exception.is_a?(@exception_class)
end