Module: Arugula::MatchAny

Included in:
CharacterClassPart, OrPart
Defined in:
lib/arugula/parts.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#partsObject

Returns the value of attribute parts.



54
55
56
# File 'lib/arugula/parts.rb', line 54

def parts
  @parts
end

Instance Method Details

#initializeObject



55
56
57
# File 'lib/arugula/parts.rb', line 55

def initialize
  @parts = []
end

#match(str, index) ⇒ Object



59
60
61
62
63
64
65
# File 'lib/arugula/parts.rb', line 59

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