Class: Conditionz::PostCondition
- Inherits:
-
Object
- Object
- Conditionz::PostCondition
- Defined in:
- lib/conditionz/post_condition.rb
Overview
Raise postcondition error when predicate is false
Class Method Summary collapse
-
.ensure(predicate, message = 'Postcondition not met') ⇒ Object
Raise postcondition error if predicate is false.
Class Method Details
.ensure(predicate, message = 'Postcondition not met') ⇒ Object
Raise postcondition error if predicate is false. Otherwise do nothing
Attributes
-
predicate- a boolean expression to eval -
message- Error message to raise
Examples
PostCondition.ensure age > 0, “Age should have been positive” PostCondition.ensure age > 0
20 21 22 |
# File 'lib/conditionz/post_condition.rb', line 20 def self.ensure predicate, = 'Postcondition not met' ConditionBase.verify predicate, PostConditionNotMetError, end |