Exception: Bang::Assertion
Overview
Bang’s assertion class. Follows standard set by BRASS project, defining ‘#assertion?` method which return `true`.
Class Method Summary collapse
-
.message(s, *a, &b) ⇒ String
Put together an error message representive of the assertion made.
-
.piece(s, a, b, t) ⇒ Assertion
Piece together an Assetion error give the message used to cause the assertion failure.
Instance Method Summary collapse
-
#assertion? ⇒ true
Bang::Assertion is alwasy an assertion.
Methods included from ExceptionExtension
Class Method Details
.message(s, *a, &b) ⇒ String
TODO:
Imporve this to better handle operators.
Put together an error message representive of the assertion made.
48 49 50 |
# File 'lib/bang.rb', line 48 def self.(s, *a, &b) "#{s}(%s)" % a.map{ |e| e.inspect }.join(',') end |
.piece(s, a, b, t) ⇒ Assertion
Piece together an Assetion error give the message used to cause the assertion failure.
35 36 37 38 39 |
# File 'lib/bang.rb', line 35 def self.piece(s, a, b, t) e = new((s, *a, &b)) e.set_backtrace(t) e end |
Instance Method Details
#assertion? ⇒ true
Bang::Assertion is alwasy an assertion.
57 58 59 |
# File 'lib/bang.rb', line 57 def assertion? true end |