diff options
author | brainopia <brainopia@evilmartians.com> | 2015-02-23 19:51:30 +0300 |
---|---|---|
committer | brainopia <brainopia@evilmartians.com> | 2015-02-23 19:57:01 +0300 |
commit | 321db4aa2edf46b8cf54c99bf3b97b48b7099dcf (patch) | |
tree | c2a07a82692e7c5ed546c02e7340ccb429d62842 /actionpack/lib/action_dispatch/routing | |
parent | e71f5dad4e0d27afbcc091173bee20bd6f4d2a4e (diff) | |
download | rails-321db4aa2edf46b8cf54c99bf3b97b48b7099dcf.tar.gz rails-321db4aa2edf46b8cf54c99bf3b97b48b7099dcf.tar.bz2 rails-321db4aa2edf46b8cf54c99bf3b97b48b7099dcf.zip |
Change filter on /rails/info/routes to use an actual path regexp from rails
Change filter on /rails/info/routes to use an actual path regexp from rails
and not approximate javascript version. Oniguruma supports much more
extensive list of features than javascript regexp engine.
Fixes #18402.
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/inspector.rb | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/actionpack/lib/action_dispatch/routing/inspector.rb b/actionpack/lib/action_dispatch/routing/inspector.rb index df5ebb6751..c513737fc2 100644 --- a/actionpack/lib/action_dispatch/routing/inspector.rb +++ b/actionpack/lib/action_dispatch/routing/inspector.rb @@ -28,23 +28,6 @@ module ActionDispatch super.to_s end - def regexp - __getobj__.path.to_regexp - end - - def json_regexp - str = regexp.inspect. - sub('\\A' , '^'). - sub('\\Z' , '$'). - sub('\\z' , '$'). - sub(/^\// , ''). - sub(/\/[a-z]*$/ , ''). - gsub(/\(\?#.+\)/ , ''). - gsub(/\(\?-\w+:/ , '('). - gsub(/\s/ , '') - Regexp.new(str).source - end - def reqs @reqs ||= begin reqs = endpoint @@ -117,11 +100,10 @@ module ActionDispatch end.reject(&:internal?).collect do |route| collect_engine_routes(route) - { name: route.name, - verb: route.verb, - path: route.path, - reqs: route.reqs, - regexp: route.json_regexp } + { name: route.name, + verb: route.verb, + path: route.path, + reqs: route.reqs } end end |