Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

stop using `send` so that method privacy is respected and we get a small

perf increase
  • Loading branch information...
commit 2dc889401c6e922c04b4783d9f0593be98e1499a 1 parent 5ad34a8
@tenderlove tenderlove authored
Showing with 7 additions and 7 deletions.
  1. +7 −7 railties/lib/rails/paths.rb
View
14 railties/lib/rails/paths.rb
@@ -81,29 +81,29 @@ def all_paths
end
def autoload_once
- filter_by(:autoload_once?)
+ filter_by { |p| p.autoload_once? }

You can just use filter_by &:autoload_once?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
end
def eager_load
- filter_by(:eager_load?)
+ filter_by { |p| p.eager_load? }
end
def autoload_paths
- filter_by(:autoload?)
+ filter_by { |p| p.autoload? }
end
def load_paths
- filter_by(:load_path?)
+ filter_by { |p| p.load_path? }
end
protected
- def filter_by(constraint)
+ def filter_by
all = []
all_paths.each do |path|
- if path.send(constraint)
+ if yield(path)
paths = path.existent
- paths -= path.children.map { |p| p.send(constraint) ? [] : p.existent }.flatten
+ paths -= path.children.map { |p| yield(p) ? [] : p.existent }.flatten
all.concat(paths)
end
end
@egilburg

You can just use filter_by &:autoload_once?

Please sign in to comment.
Something went wrong with that request. Please try again.