Class: Patm::Pattern::And
Instance Method Summary
collapse
Methods inherited from LogicalOp
#compile_internal
#&, build_from, #compile, #compile_internal
Constructor Details
#initialize(pats) ⇒ And
Returns a new instance of And.
254
255
256
|
# File 'lib/patm.rb', line 254
def initialize(pats)
super(pats, '&&')
end
|
Instance Method Details
#execute(mmatch, obj) ⇒ Object
257
258
259
260
261
|
# File 'lib/patm.rb', line 257
def execute(mmatch, obj)
@pats.all? do|pat|
pat.execute(mmatch, obj)
end
end
|
#inspect ⇒ Object
265
266
267
|
# File 'lib/patm.rb', line 265
def inspect
"AND(#{@pats.map(&:inspect).join(',')})"
end
|
#rest? ⇒ Boolean
262
263
264
|
# File 'lib/patm.rb', line 262
def rest?
@pats.any?(&:rest?)
end
|