diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-26 16:07:28 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-26 16:07:28 -0700 |
commit | 33da24a8dbc87953e416eff75a7300ab5fd36905 (patch) | |
tree | 531be306c728d89b84cf70b56789bdca776ecce0 | |
parent | 47db156d4273fbc79d20b7461e8419e13a796445 (diff) | |
download | rails-33da24a8dbc87953e416eff75a7300ab5fd36905.tar.gz rails-33da24a8dbc87953e416eff75a7300ab5fd36905.tar.bz2 rails-33da24a8dbc87953e416eff75a7300ab5fd36905.zip |
eliminating a branch we do not need. thanks @jeremy
-rw-r--r-- | railties/lib/rails/paths.rb | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb index f849d8bfc3..936b91f134 100644 --- a/railties/lib/rails/paths.rb +++ b/railties/lib/rails/paths.rb @@ -156,25 +156,9 @@ module Rails path = File.expand_path(p, @root.path) if @glob - if File.directory? path - result.concat expand_dir(path, @glob) - else - # FIXME: I think we can remove this branch, but I'm not sure. - # Say the filesystem has this file: - # - # /tmp/foobar - # - # and someone adds this path: - # - # /tmp/foo - # - # with a glob of "*", then this function will return - # - # /tmp/foobar - # - # We need to figure out if that is desired behavior. - result.concat expand_file(path, @glob) - end + result.concat Dir.chdir(path) { + Dir.glob(@glob).map { |file| File.join path, file }.sort + } else result << path end @@ -194,17 +178,6 @@ module Rails end alias to_a expanded - - private - def expand_file(path, glob) - Dir[File.join(path, glob)].sort - end - - def expand_dir(path, glob) - Dir.chdir(path) do - Dir.glob(glob).map { |file| File.join path, file }.sort - end - end end end end |