Class: Rrrex::GroupMatch

Inherits:
Match
  • Object
show all
Includes:
SingleAtomMatch
Defined in:
lib/rrrex/group_match.rb

Instance Attribute Summary

Attributes included from SingleAtomMatch

#atom

Instance Method Summary collapse

Methods inherited from Match

#+, convert, #match, #not, #or, #wrap

Constructor Details

#initialize(atom, name) ⇒ GroupMatch

Returns a new instance of GroupMatch.



6
7
8
9
# File 'lib/rrrex/group_match.rb', line 6

def initialize atom, name
  @name = name
  super atom
end

Instance Method Details

#group_namesObject



15
16
17
18
# File 'lib/rrrex/group_match.rb', line 15

def group_names
  names = @atom.group_names || []
  names.unshift @name
end

#to_regexp_stringObject



11
12
13
# File 'lib/rrrex/group_match.rb', line 11

def to_regexp_string
  "(#{atom.to_regexp_string})"
end