Permalink
Browse files

Further refactor build_conditions in route set

Return the conditions from the keep_if call, and ignore the value
argument since it's not being used.
  • Loading branch information...
1 parent a63fc94 commit ac7e1700f1fd08b50011c256bfa2e382517edb4a @carlosantoniodasilva carlosantoniodasilva committed Aug 11, 2012
Showing with 3 additions and 5 deletions.
  1. +3 −5 actionpack/lib/action_dispatch/routing/route_set.rb
@@ -409,21 +409,19 @@ def build_path(path, requirements, separators, anchor)
def build_conditions(current_conditions, path_values)
conditions = current_conditions.dup
- verbs = conditions[: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.
+ verbs = conditions[:request_method] || []
unless verbs.empty?
conditions[:request_method] = %r[^#{verbs.join('|')}$]
end
- conditions.keep_if do |k,v|
+
+ conditions.keep_if do |k, _|
k == :action || k == :controller ||
@request_class.public_method_defined?(k) || path_values.include?(k)
end
-
- conditions
end
private :build_conditions

0 comments on commit ac7e170

Please sign in to comment.