Module: Arugula::MatchAll

Included in:
AndPart, CapturePart
Defined in:
lib/arugula/parts.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#partsObject

Returns the value of attribute parts.



35
36
37
# File 'lib/arugula/parts.rb', line 35

def parts
  @parts
end

Instance Method Details

#initializeObject



36
37
38
# File 'lib/arugula/parts.rb', line 36

def initialize
  @parts = []
end

#match(str, index, match_data) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/arugula/parts.rb', line 40

def match(str, index, match_data)
  parts.each do |part|
    match, index = part.match(str, index, match_data)
    return false, index unless match
  end
  [true, index]
end