Exception: AE::Assertion
Overview
The Assertion class is simply a subclass of Exception that is used by AE as the default error raised when an assertion fails.
"The reserve of modern assertions is sometimes pushed to extremes,
in which the fear of being contradicted leads the writer to strip
himself of almost all sense and meaning."
-- Sir Winston Churchill (1874 - 1965)
Class Method Summary collapse
-
.counts ⇒ Object
DEPRECATE: This will be removed in favor of Assertor#counts.
Instance Method Summary collapse
-
#assertion? ⇒ Boolean
Technically any object that affirmatively responds to #assertion? can be taken to be an Assertion.
-
#initialize(message = nil, options = {}) ⇒ Assertion
constructor
New assertion (failure).
- #to_s ⇒ Object
Methods inherited from Exception
#negative?, raised?, #set_assertion, #set_negative
Constructor Details
#initialize(message = nil, options = {}) ⇒ Assertion
New assertion (failure).
message - the failure message options - such as :backtrace
26 27 28 29 30 31 |
# File 'lib/ae/assertion.rb', line 26 def initialize(=nil, ={}) super() backtrace = [:backtrace] set_backtrace(backtrace) if backtrace set_assertion(true) end |
Class Method Details
Instance Method Details
#assertion? ⇒ Boolean
Technically any object that affirmatively responds to #assertion? can be taken to be an Assertion. This makes it easier for various libraries to work together without having to depend upon a common Assertion base class.
37 38 39 |
# File 'lib/ae/assertion.rb', line 37 def assertion? true end |
#to_s ⇒ Object
42 43 44 |
# File 'lib/ae/assertion.rb', line 42 def to_s '(assertion) ' + super end |