Class: PathList::PathRegexpBuilder

Inherits:
String
  • Object
show all
Defined in:
lib/path_list/path_regexp_builder.rb

Instance Method Summary collapse

Instance Method Details

#append_any_dirObject



20
21
22
# File 'lib/path_list/path_regexp_builder.rb', line 20

def append_any_dir
  append_unescaped('(?:.*/)?')
end

#append_any_non_dirObject



28
29
30
31
# File 'lib/path_list/path_regexp_builder.rb', line 28

def append_any_non_dir
  append_one_non_dir
  append_unescaped('*')
end

#append_character_class_closeObject



66
67
68
# File 'lib/path_list/path_regexp_builder.rb', line 66

def append_character_class_close
  append_unescaped(']')
end

#append_character_class_dashObject



62
63
64
# File 'lib/path_list/path_regexp_builder.rb', line 62

def append_character_class_dash
  append_unescaped('-')
end

#append_character_class_negationObject



58
59
60
# File 'lib/path_list/path_regexp_builder.rb', line 58

def append_character_class_negation
  append_unescaped('^')
end

#append_character_class_openObject



54
55
56
# File 'lib/path_list/path_regexp_builder.rb', line 54

def append_character_class_open
  append_unescaped('(?!/)[')
end

#append_dirObject



16
17
18
# File 'lib/path_list/path_regexp_builder.rb', line 16

def append_dir
  append_unescaped('/')
end

#append_dir_or_end_anchorObject



50
51
52
# File 'lib/path_list/path_regexp_builder.rb', line 50

def append_dir_or_end_anchor
  append_unescaped('(?:/|\\z)')
end

#append_dir_or_start_anchorObject



46
47
48
# File 'lib/path_list/path_regexp_builder.rb', line 46

def append_dir_or_start_anchor
  append_unescaped('(?:\\A|/)')
end

#append_end_anchorObject



38
39
40
# File 'lib/path_list/path_regexp_builder.rb', line 38

def append_end_anchor
  append_unescaped('\\z')
end

#append_escaped(value) ⇒ Object



10
11
12
13
14
# File 'lib/path_list/path_regexp_builder.rb', line 10

def append_escaped(value)
  return unless value

  append_unescaped(::Regexp.escape(value))
end

#append_many_non_dirObject



33
34
35
36
# File 'lib/path_list/path_regexp_builder.rb', line 33

def append_many_non_dir
  append_one_non_dir
  append_unescaped('+')
end

#append_one_non_dirObject



24
25
26
# File 'lib/path_list/path_regexp_builder.rb', line 24

def append_one_non_dir
  append_unescaped('[^/]')
end

#append_start_anchorObject



42
43
44
# File 'lib/path_list/path_regexp_builder.rb', line 42

def append_start_anchor
  append_unescaped('\\A')
end

#to_regexpObject



5
6
7
8
# File 'lib/path_list/path_regexp_builder.rb', line 5

def to_regexp
  # Regexp::IGNORECASE = 1
  ::Regexp.new(self, 1)
end