Exception: Assertion
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 ⇒ String
Parents error message prefixed with “(assertion)”.
Methods inherited from Exception
Constructor Details
#initialize(message = nil, options = {}) ⇒ Assertion
New assertion (failure).
8 9 10 11 12 13 |
# File 'lib/test/core_ext/assertion.rb', line 8 def initialize(=nil, ={}) super() backtrace = [:backtrace] set_backtrace(backtrace) if backtrace @assertion = true end |
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.
19 20 21 |
# File 'lib/test/core_ext/assertion.rb', line 19 def assertion? true # @assertion end |
#to_s ⇒ String
Parents error message prefixed with “(assertion)”.
26 27 28 |
# File 'lib/test/core_ext/assertion.rb', line 26 def to_s '(assertion) ' + super end |