Class: Conditions::NotCondition
- Inherits:
-
BaseCondition
- Object
- BaseCondition
- Conditions::NotCondition
- Defined in:
- lib/conditions.rb
Overview
Checks if a condition is not true
Instance Method Summary collapse
- #apply(value) ⇒ true, false
-
#initialize(predicate) ⇒ NotCondition
constructor
A new instance of NotCondition.
Constructor Details
#initialize(predicate) ⇒ NotCondition
Returns a new instance of NotCondition.
123 124 125 126 127 128 |
# File 'lib/conditions.rb', line 123 def initialize(predicate) raise ConditionError, 'Not condition predicate a condition' unless predicate.is_a?(Hash) && predicate.key?('class') predicate = Object.const_get("Conditions::#{predicate['class']}").new(predicate['predicate']) super(predicate) end |
Instance Method Details
#apply(value) ⇒ true, false
134 135 136 |
# File 'lib/conditions.rb', line 134 def apply(value) !@predicate.apply(value) end |