Class: Patm::Pattern::Or
- Inherits:
-
LogicalOp
- Object
- Patm::Pattern
- LogicalOp
- Patm::Pattern::Or
- Defined in:
- lib/patm.rb
Instance Method Summary collapse
- #execute(mmatch, obj) ⇒ Object
-
#initialize(pats) ⇒ Or
constructor
A new instance of Or.
- #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) ⇒ Or
Returns a new instance of Or.
381 382 383 |
# File 'lib/patm.rb', line 381 def initialize(pats) super(pats, '||') end |
Instance Method Details
#execute(mmatch, obj) ⇒ Object
384 385 386 387 388 |
# File 'lib/patm.rb', line 384 def execute(mmatch, obj) @pats.any? do|pat| pat.execute(mmatch, obj) end end |
#inspect ⇒ Object
389 390 391 |
# File 'lib/patm.rb', line 389 def inspect "OR(#{@pats.map(&:inspect).join(',')})" end |