Class: RegexBuilder
- Inherits:
-
Object
- Object
- RegexBuilder
- Defined in:
- lib/guuby/regex_builder.rb
Instance Method Summary collapse
- #any ⇒ Object
- #end_with(tail) ⇒ Object
- #start_with(head) ⇒ Object (also: #begin_with)
- #to_s ⇒ Object
Instance Method Details
#any ⇒ Object
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_s ⇒ Object
5 6 7 |
# File 'lib/guuby/regex_builder.rb', line 5 def to_s /#@pattern/ end |