Class: Invariant
Defined Under Namespace
Classes: AssertionError
Instance Attribute Summary collapse
-
#failure_handler ⇒ Object
Returns the value of attribute failure_handler.
Class Method Summary collapse
Instance Attribute Details
#failure_handler ⇒ Object
Returns the value of attribute failure_handler.
9 10 11 |
# File 'lib/invariant.rb', line 9 def failure_handler @failure_handler end |
Class Method Details
.disable_assertions ⇒ Object
15 16 17 |
# File 'lib/invariant.rb', line 15 def self.disable_assertions failure_handler { } end |
.enable_assertions ⇒ Object
11 12 13 |
# File 'lib/invariant.rb', line 11 def self.enable_assertions failure_handler { |msg| raise AssertionError.new(msg) } end |
.failure_handler(&block) ⇒ Object
19 20 21 |
# File 'lib/invariant.rb', line 19 def self.failure_handler(&block) instance.failure_handler = block end |