Class: Patm::Pattern::And

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

Returns a new instance of And.



376
377
378
# File 'lib/patm.rb', line 376

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

Instance Method Details

#execute(mmatch, obj) ⇒ Object



379
380
381
382
383
# File 'lib/patm.rb', line 379

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

#inspectObject



384
385
386
# File 'lib/patm.rb', line 384

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