Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Remove unecessary variable call since `sort!` always returns the sorted array #10131

Merged
merged 1 commit into from

4 participants

@agis-

No description provided.

@dmathieu
Collaborator

You don't even need to use sort!. Using sort would be enough here.
This applies to the helpers variable just below too.

@carlosantoniodasilva

@dmathieu at least we avoid creating a few extra objects :).

@carlosantoniodasilva carlosantoniodasilva merged commit d695100 into rails:master
@dmathieu
Collaborator

@carlosantoniodasilva: I'm not saying this is bad. I'm saying we create even less extra objects :)

@vipulnsward

@dmathieu sort! is faster than sort, and avoid creating a shallow copy of the original object

@agis- agis- deleted the unknown repository branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 0 additions and 1 deletion.
  1. +0 −1  actionpack/lib/action_controller/metal/helpers.rb
View
1  actionpack/lib/action_controller/metal/helpers.rb
@@ -94,7 +94,6 @@ def all_helpers_from_path(path)
extract = /^#{Regexp.quote(_path.to_s)}\/?(.*)_helper.rb$/
names = Dir["#{_path}/**/*_helper.rb"].map { |file| file.sub(extract, '\1') }
names.sort!
- names
end
helpers.uniq!
helpers
Something went wrong with that request. Please try again.