Class: Rrrex::Match

Inherits:
Object
  • Object
show all
Defined in:
lib/rrrex/match.rb,
lib/rrrex/match.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.convert(atom) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/rrrex/match.rb', line 13

def self.convert( atom )
  if atom.kind_of? Match
    atom
  elsif atom.kind_of? Range
    RangeMatch.new atom
  else
    StringMatch.new atom
  end
end

Instance Method Details

#+(p) ⇒ Object



35
36
37
# File 'lib/rrrex/match.rb', line 35

def +(p)
  ConcatMatch.new self, p
end

#group_namesObject



43
44
45
# File 'lib/rrrex/match.rb', line 43

def group_names
  []
end

#match(str) ⇒ Object



27
28
29
# File 'lib/rrrex/match.rb', line 27

def match(str)
  Regexp.new( self ).match str
end

#not(atom) ⇒ Object



39
40
41
# File 'lib/rrrex/match.rb', line 39

def not(atom)
  ConcatMatch.new NotMatch.new( atom ), self
end

#or(atom) ⇒ Object



31
32
33
# File 'lib/rrrex/match.rb', line 31

def or(atom)
  OrMatch.new self, atom
end

#wrap(s) ⇒ Object



23
24
25
# File 'lib/rrrex/match.rb', line 23

def wrap( s )
  "(?:#{s})"
end