Method: ActionDispatch::Routing::RouteWrapper#json_regexp
- Defined in:
- actionpack/lib/action_dispatch/routing/inspector.rb
#json_regexp ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'actionpack/lib/action_dispatch/routing/inspector.rb', line 42 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 |