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


57
58
59
# File 'lib/arugula/parts.rb', line 57

def parts
  @parts
end

Instance Method Details

#initializeObject


58
59
60
# File 'lib/arugula/parts.rb', line 58

def initialize
  @parts = []
end

#match(str, index, match_data) ⇒ Object


62
63
64
65
66
67
68
# File 'lib/arugula/parts.rb', line 62

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