Class: RegexBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/guuby/regex_builder.rb

Instance Method Summary collapse

Instance Method Details

#anyObject



15
16
17
18
# File 'lib/guuby/regex_builder.rb', line 15

def any
  @pattern += ".*"
  self
end

#end_with(tail) ⇒ Object



20
21
22
23
# File 'lib/guuby/regex_builder.rb', line 20

def end_with(tail)
  @pattern += (tail + "$")
  self
end

#start_with(head) ⇒ Object Also known as: begin_with



9
10
11
12
# File 'lib/guuby/regex_builder.rb', line 9

def start_with(head)
  @pattern = "^" + head
  self
end

#to_sObject



5
6
7
# File 'lib/guuby/regex_builder.rb', line 5

def to_s
  /#@pattern/
end