Module: Rrrex::DslContext

Defined in:
lib/rrrex/dsl_context.rb

Constant Summary collapse

WORD_CHAR =
'\w'
DIGIT =
'\d'
WHITESPACE =
'\s'
LETTER =
'[[:alpha:]]'
ANY_CHAR =
'.'

Class Method Summary collapse

Class Method Details

._not(r) ⇒ Object



29
30
31
# File 'lib/rrrex/dsl_context.rb', line 29

def self._not r
  any_char.not r
end

.any(r) ⇒ Object



21
22
23
# File 'lib/rrrex/dsl_context.rb', line 21

def self.any r
  NumberMatch.new r, 0, nil
end

.group(name_or_atom = nil, atom = nil, &block) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/rrrex/dsl_context.rb', line 33

def self.group( name_or_atom=nil, atom=nil, &block )
  if name_or_atom.kind_of? Symbol
    name = name_or_atom
    atom = atom || DslContext.module_exec( &block )
  elsif name_or_atom.kind_of? Hash
    name = name_or_atom.keys.first
    atom = name_or_atom[ name ]
  else
    name = nil
    atom = name_or_atom
  end
  GroupMatch.new atom, name
end

.some(r) ⇒ Object



25
26
27
# File 'lib/rrrex/dsl_context.rb', line 25

def self.some r
  NumberMatch.new r, 1, nil
end