Class: Patm::Pattern::Or

Inherits:
LogicalOp show all
Defined in:
lib/patm.rb

Instance Method Summary collapse

Methods inherited from LogicalOp

#compile_internal, #inspect, #opt?, #rest?

Methods inherited from Patm::Pattern

#&, #[], build_from, build_from_array, build_from_hash, #compile, #compile_internal, #opt, #opt?, #rest?

Constructor Details

#initialize(pats) ⇒ Or

Returns a new instance of Or.



476
477
478
# File 'lib/patm.rb', line 476

def initialize(pats)
  super('OR', pats, '||')
end

Instance Method Details

#execute(mmatch, obj) ⇒ Object



479
480
481
482
483
# File 'lib/patm.rb', line 479

def execute(mmatch, obj)
  @pats.any? do|pat|
    pat.execute(mmatch, obj)
  end
end