lib/ae/assertion.rb in ae-1.7.4 vs lib/ae/assertion.rb in ae-1.8.0
- old
+ new
@@ -11,19 +11,20 @@
# -- Sir Winston Churchill (1874 - 1965)
#
#
class Assertion < Exception
- # DEPRECATE: This will be removed in favor of Assertor#counts.
+ # @deprecated
+ # This will be removed in favor of `AE::Assertor.counts`.
def self.counts
AE::Assertor.counts
end
# New assertion (failure).
#
- # message - the failure message
- # options - such as :backtrace
+ # @param message [String] the failure message
+ # @param options [Hash] options such as :backtrace
#
def initialize(message=nil, options={})
super(message)
backtrace = options[:backtrace]
set_backtrace(backtrace) if backtrace
@@ -36,16 +37,18 @@
# Assertion base class.
def assertion?
true
end
+ # Parents error message prefixed with "(assertion)".
#
+ # @return [String] error message
def to_s
'(assertion) ' + super
end
end
end
-# Set top-level Assertion to AE::Assertion
-Assertion = AE::Assertion
+# Set top-level Assertion to AE::Assertion if not already present.
+Assertion = AE::Assertion unless defined?(Assertion)