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.



362
363
364
# File 'lib/patm.rb', line 362

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

Instance Method Details

#execute(mmatch, obj) ⇒ Object



365
366
367
368
369
# File 'lib/patm.rb', line 365

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

#inspectObject



370
371
372
# File 'lib/patm.rb', line 370

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