Class: Yargi::NotPredicate
- Defined in:
- lib/yargi/predicate.rb
Overview
Negates another predicate
Constant Summary
Constants inherited from Predicate
Predicate::ALL, Predicate::NONE
Instance Method Summary collapse
-
#===(elm) ⇒ Object
Predicate implementation.
-
#initialize(negated) ⇒ NotPredicate
constructor
Creates a ‘not(negated)’ predicate.
-
#inspect ⇒ Object
Helps debugging predicates.
Methods inherited from Predicate
#&, #not, to_predicate, #|
Constructor Details
#initialize(negated) ⇒ NotPredicate
Creates a ‘not(negated)’ predicate
139 140 141 |
# File 'lib/yargi/predicate.rb', line 139 def initialize(negated) @negated = Predicate.to_predicate(negated) end |
Instance Method Details
#===(elm) ⇒ Object
Predicate implementation
144 145 146 |
# File 'lib/yargi/predicate.rb', line 144 def ===(elm) not(@negated === elm) end |
#inspect ⇒ Object
Helps debugging predicates
149 150 151 |
# File 'lib/yargi/predicate.rb', line 149 def inspect "not(#{@negated})" end |