Class: Patm::Pattern::And
- Inherits:
-
LogicalOp
- Object
- Patm::Pattern
- LogicalOp
- Patm::Pattern::And
- Defined in:
- lib/patm.rb
Instance Method Summary collapse
- #execute(mmatch, obj) ⇒ Object
-
#initialize(pats) ⇒ And
constructor
A new instance of And.
- #inspect ⇒ Object
Methods inherited from LogicalOp
#compile_internal, #opt?, #rest?
Methods inherited from Patm::Pattern
#&, #[], build_from, #compile, #compile_internal, #opt, #opt?, #rest?
Constructor Details
#initialize(pats) ⇒ And
Returns a new instance of And.
376 377 378 |
# File 'lib/patm.rb', line 376 def initialize(pats) super(pats, '&&') end |
Instance Method Details
#execute(mmatch, obj) ⇒ Object
379 380 381 382 383 |
# File 'lib/patm.rb', line 379 def execute(mmatch, obj) @pats.all? do|pat| pat.execute(mmatch, obj) end end |
#inspect ⇒ Object
384 385 386 |
# File 'lib/patm.rb', line 384 def inspect "AND(#{@pats.map(&:inspect).join(',')})" end |