aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-10-19 23:32:06 -0500
committerJoshua Peek <josh@joshpeek.com>2009-10-19 23:32:17 -0500
commita1df2590744ed126981dfd5b5709ff6fd5dc6476 (patch)
tree1c01e2ba7465f554a2470155c46c0309dfe7615f /activesupport
parentcbedcb06152ed6d7e7457334cd45af5ab24ef6ea (diff)
downloadrails-a1df2590744ed126981dfd5b5709ff6fd5dc6476.tar.gz
rails-a1df2590744ed126981dfd5b5709ff6fd5dc6476.tar.bz2
rails-a1df2590744ed126981dfd5b5709ff6fd5dc6476.zip
Replace decaying routing internals w/ rack-mount
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/regexp.rb22
-rw-r--r--activesupport/test/core_ext/regexp_ext_test.rb19
2 files changed, 0 insertions, 41 deletions
diff --git a/activesupport/lib/active_support/core_ext/regexp.rb b/activesupport/lib/active_support/core_ext/regexp.rb
index 95d06ee6ee..784145f5fb 100644
--- a/activesupport/lib/active_support/core_ext/regexp.rb
+++ b/activesupport/lib/active_support/core_ext/regexp.rb
@@ -1,27 +1,5 @@
class Regexp #:nodoc:
- def number_of_captures
- Regexp.new("|#{source}").match('').captures.length
- end
-
def multiline?
options & MULTILINE == MULTILINE
end
-
- class << self
- def optionalize(pattern)
- return pattern if pattern == ""
-
- case unoptionalize(pattern)
- when /\A(.|\(.*\))\Z/ then "#{pattern}?"
- else "(?:#{pattern})?"
- end
- end
-
- def unoptionalize(pattern)
- [/\A\(\?:(.*)\)\?\Z/, /\A(.|\(.*\))\?\Z/].each do |regexp|
- return $1 if regexp =~ pattern
- end
- return pattern
- end
- end
end
diff --git a/activesupport/test/core_ext/regexp_ext_test.rb b/activesupport/test/core_ext/regexp_ext_test.rb
index cc3f07d5c5..68b089d5b4 100644
--- a/activesupport/test/core_ext/regexp_ext_test.rb
+++ b/activesupport/test/core_ext/regexp_ext_test.rb
@@ -2,28 +2,9 @@ require 'abstract_unit'
require 'active_support/core_ext/regexp'
class RegexpExtAccessTests < Test::Unit::TestCase
- def test_number_of_captures
- assert_equal 0, //.number_of_captures
- assert_equal 1, /.(.)./.number_of_captures
- assert_equal 2, /.(.).(?:.).(.)/.number_of_captures
- assert_equal 3, /.((.).(?:.).(.))/.number_of_captures
- end
-
def test_multiline
assert_equal true, //m.multiline?
assert_equal false, //.multiline?
assert_equal false, /(?m:)/.multiline?
end
-
- def test_optionalize
- assert_equal "a?", Regexp.optionalize("a")
- assert_equal "(?:foo)?", Regexp.optionalize("foo")
- assert_equal "", Regexp.optionalize("")
- end
-
- def test_unoptionalize
- assert_equal "a", Regexp.unoptionalize("a?")
- assert_equal "foo", Regexp.unoptionalize("(?:foo)?")
- assert_equal "", Regexp.unoptionalize("")
- end
end