Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #21075 from byroot/not-empty-vs-any

Array#any? is slower and not the inverse of Array#empty?
  • Loading branch information...
commit f8e81d41200d9310c95dd397d65f745aa6f45d3a 2 parents 5373bf2 + 32133db
@rafaelfranca rafaelfranca authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 actionpack/lib/action_dispatch/journey/formatter.rb
View
4 actionpack/lib/action_dispatch/journey/formatter.rb
@@ -25,7 +25,7 @@ def generate(name, options, path_parameters, parameterize = nil)
next unless name || route.dispatcher?
missing_keys = missing_keys(route, parameterized_parts)
- next if missing_keys && missing_keys.any?
+ next if missing_keys && !missing_keys.empty?
params = options.dup.delete_if do |key, _|
parameterized_parts.key?(key) || route.defaults.key?(key)
end
@@ -40,7 +40,7 @@ def generate(name, options, path_parameters, parameterize = nil)
end
message = "No route matches #{Hash[constraints.sort_by{|k,v| k.to_s}].inspect}"
- message << " missing required keys: #{missing_keys.sort.inspect}" if missing_keys && missing_keys.any?
+ message << " missing required keys: #{missing_keys.sort.inspect}" if missing_keys && !missing_keys.empty?
raise ActionController::UrlGenerationError, message
end
Please sign in to comment.
Something went wrong with that request. Please try again.