Class: Patm::Pattern::Or

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

Instance Method Summary collapse

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

#inspectObject



389
390
391
# File 'lib/patm.rb', line 389

def inspect
  "OR(#{@pats.map(&:inspect).join(',')})"
end