aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb24
1 files changed, 15 insertions, 9 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index e964bf59e0..42257ac3d7 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -144,12 +144,13 @@ module ActionDispatch
end
def make_route(name, precedence)
- route = Journey::Route.build(name,
+ route = Journey::Route.new(name,
application,
path,
conditions,
required_defaults,
- defaults)
+ defaults,
+ request_method)
route.precedence = precedence
route
@@ -170,20 +171,25 @@ module ActionDispatch
def build_conditions(current_conditions, request_class)
conditions = current_conditions.dup
+ conditions.keep_if do |k, _|
+ request_class.public_method_defined?(k)
+ end
+ end
+ private :build_conditions
+
+ def request_method
# Rack-Mount requires that :request_method be a regular expression.
# :request_method represents the HTTP verb that matches this route.
#
# Here we munge values before they get sent on to rack-mount.
- unless @via == [:all]
+ if @via == [:all]
+ //
+ else
verbs = @via.map { |m| m.to_s.dasherize.upcase }
- conditions[:request_method] = %r[^#{verbs.join('|')}$]
- end
-
- conditions.keep_if do |k, _|
- request_class.public_method_defined?(k)
+ %r[^#{verbs.join('|')}$]
end
end
- private :build_conditions
+ private :request_method
JOINED_SEPARATORS = SEPARATORS.join # :nodoc: