Class: Regexp
- Inherits:
-
Object
- Object
- Regexp
- Defined in:
- lib/core_ext/regexp.rb
Defined Under Namespace
Classes: Template
Instance Method Summary collapse
Instance Method Details
permalink #append(other_regex) ⇒ Object
[View source]
4 5 6 7 8 9 10 11 |
# File 'lib/core_ext/regexp.rb', line 4 def append(other_regex) if(other_regex.is_a? Regexp) other_string = other_regex.source else other_string = other_regex.to_s end Regexp.new(self.source+other_string) end |
permalink #prepend(other_regex) ⇒ Object
[View source]
12 13 14 15 16 17 18 19 |
# File 'lib/core_ext/regexp.rb', line 12 def prepend(other_regex) if(other_regex.is_a? Regexp) other_string = other_regex.source else other_string = other_regex.to_s end Regexp.new(other_string+self.source) end |
permalink #template ⇒ Object
[View source]
20 21 22 23 24 25 |
# File 'lib/core_ext/regexp.rb', line 20 def template if(!@template) @template = Regexp::Template.new(source:self.source) end return @template end |