Class: Yargi::TagPredicate
- Defined in:
- lib/yargi/predicate.rb
Overview
Decorates a module instance as a predicate
Constant Summary
Constants inherited from Predicate
Predicate::ALL, Predicate::NONE
Instance Method Summary collapse
-
#===(elm) ⇒ Object
Predicate implementation.
-
#initialize(mod) ⇒ TagPredicate
constructor
Creates a Tag predicate.
-
#inspect ⇒ Object
Helps debugging predicates.
Methods inherited from Predicate
#&, #not, to_predicate, #|
Constructor Details
#initialize(mod) ⇒ TagPredicate
Creates a Tag predicate
97 98 99 100 |
# File 'lib/yargi/predicate.rb', line 97 def initialize(mod) raise ArgumentError, "Module expected, #{mod} received" unless Module===mod @mod = mod end |
Instance Method Details
#===(elm) ⇒ Object
Predicate implementation
103 104 105 |
# File 'lib/yargi/predicate.rb', line 103 def ===(elm) @mod===elm end |
#inspect ⇒ Object
Helps debugging predicates
108 109 110 |
# File 'lib/yargi/predicate.rb', line 108 def inspect "is_a?(#{@mod})" end |