Class: Assert::Assertions::CheckException
- Inherits:
-
Object
- Object
- Assert::Assertions::CheckException
- Defined in:
- lib/assert/assertions.rb
Overview
exception raised utility classes
Direct Known Subclasses
Instance Attribute Summary collapse
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
-
#msg ⇒ Object
readonly
Returns the value of attribute msg.
Instance Method Summary collapse
-
#initialize(exceptions, &block) ⇒ CheckException
constructor
A new instance of CheckException.
- #raised? ⇒ Boolean
Constructor Details
#initialize(exceptions, &block) ⇒ CheckException
Returns a new instance of CheckException.
178 179 180 181 182 |
# File 'lib/assert/assertions.rb', line 178 def initialize(exceptions, &block) @exceptions = exceptions begin; block.call; rescue Exception => @exception; end @msg = "#{exceptions_sentence(@exceptions)} #{exception_details}" end |
Instance Attribute Details
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
176 177 178 |
# File 'lib/assert/assertions.rb', line 176 def exception @exception end |
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
176 177 178 |
# File 'lib/assert/assertions.rb', line 176 def msg @msg end |
Instance Method Details
#raised? ⇒ Boolean
184 185 186 |
# File 'lib/assert/assertions.rb', line 184 def raised? !@exception.nil? && is_one_of?(@exception, @exceptions) end |