Class: Conditionz::PreCondition
- Inherits:
-
Object
- Object
- Conditionz::PreCondition
- Defined in:
- lib/conditionz/pre_condition.rb
Overview
Raise precondition error when predicate is false
Class Method Summary collapse
-
.require(predicate, message = 'Precondition not met') ⇒ Object
Raise precondition error if predicate is false.
Class Method Details
.require(predicate, message = 'Precondition not met') ⇒ Object
Raise precondition error if predicate is false. Otherwise do nothing
Attributes
-
predicate- a boolean expression to eval -
message- Error message to raise
Examples
PreCondition.require age > 0, “Age must be positive” PreCondition.require age > 0
20 21 22 |
# File 'lib/conditionz/pre_condition.rb', line 20 def self.require predicate, = 'Precondition not met' ConditionBase.verify predicate, PreConditionNotMetError, end |