Class: Regexp

Inherits:
Object
  • Object
show all
Defined in:
lib/utopia/extensions/regexp.rb

Overview

This file is part of the “Utopia Framework” project, and is licensed under the GNU AGPLv3. Copyright 2010 Samuel Williams. All rights reserved. See <utopia.rb> for licensing details.

Class Method Summary collapse

Class Method Details

.contains(string) ⇒ Object



14
15
16
# File 'lib/utopia/extensions/regexp.rb', line 14

def self.contains(string)
	return Regexp.new(string)
end

.ends_with(string) ⇒ Object



10
11
12
# File 'lib/utopia/extensions/regexp.rb', line 10

def self.ends_with(string)
	return /#{Regexp.escape(string)}$/
end

.starts_with(string) ⇒ Object



6
7
8
# File 'lib/utopia/extensions/regexp.rb', line 6

def self.starts_with(string)
	return /^#{Regexp.escape(string)}/
end