Module: Desiru::Assertions
- Defined in:
- lib/desiru/assertions.rb
Overview
Assertion system for validating module outputs
Defined Under Namespace
Classes: AssertionError, Configuration
Class Method Summary collapse
-
.assert(condition, message = nil) ⇒ Object
Assert that a condition is true, raising AssertionError if false.
-
.configuration ⇒ Object
Get or set the assertion configuration.
-
.configure {|configuration| ... } ⇒ Object
Configure assertion behavior.
-
.suggest(condition, message = nil) ⇒ Object
Suggest that a condition should be true, logging a warning if false.
Class Method Details
.assert(condition, message = nil) ⇒ Object
Assert that a condition is true, raising AssertionError if false
26 27 28 29 30 31 |
# File 'lib/desiru/assertions.rb', line 26 def self.assert(condition, = nil) return if condition ||= 'Assertion failed' raise AssertionError, end |
.configuration ⇒ Object
Get or set the assertion configuration
56 57 58 |
# File 'lib/desiru/assertions.rb', line 56 def self.configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
Configure assertion behavior
61 62 63 |
# File 'lib/desiru/assertions.rb', line 61 def self.configure yield(configuration) if block_given? end |