Class: Patm::Pattern::And

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) ⇒ And

Returns a new instance of And.



487
488
489
# File 'lib/patm.rb', line 487

def initialize(pats)
  super('AND', pats, '&&')
end

Instance Method Details

#execute(mmatch, obj) ⇒ Object



490
491
492
493
494
# File 'lib/patm.rb', line 490

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