Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't shadow outer local variables

  • Loading branch information...
commit 4d341f2115661b3e88589d91b5df74c9d889b778 1 parent 33393a2
@jacknagel jacknagel authored
View
2  Library/Homebrew/cmd/doctor.rb
@@ -607,7 +607,7 @@ def check_for_config_scripts
configs = Dir["#{p}/*-config"]
# puts "#{p}\n #{configs * ' '}" unless configs.empty?
- config_scripts << [p, configs.collect {|p| File.basename(p)}] unless configs.empty?
+ config_scripts << [p, configs.map { |c| File.basename(c) }] unless configs.empty?
end
unless config_scripts.empty?
View
6 Library/Homebrew/cmd/prune.rb
@@ -9,9 +9,9 @@ def prune
$d = 0
dirs = []
- Keg::PRUNEABLE_DIRECTORIES.each do |path|
- next unless path.directory?
- path.find do |path|
+ Keg::PRUNEABLE_DIRECTORIES.each do |dir|
+ next unless dir.directory?
+ dir.find do |path|
path.extend ObserverPathnameExtension
if path.symlink?
unless path.resolved_path_exists?
View
4 Library/Homebrew/compilers.rb
@@ -149,10 +149,10 @@ def advise
so that we can update the formula accordingly. Thanks!
EOS
- viable = @compilers.reject { |cc| @f.fails_with? cc }
+ viable = @compilers.reject { |c| @f.fails_with? c }
unless viable.empty?
warning += "\nIf it fails you can use "
- options = viable.map { |cc| "--use-#{cc.name}" }
+ options = viable.map { |c| "--use-#{c.name}" }
warning += "#{options*' or '} to try a different compiler."
end
View
12 Library/Homebrew/extend/ENV.rb
@@ -391,9 +391,9 @@ def append_to_cflags newflags
def remove_from_cflags f
remove cc_flag_vars, f
end
- def append key, value, separator = ' '
+ def append keys, value, separator = ' '
value = value.to_s
- [*key].each do |key|
+ Array(keys).each do |key|
unless self[key].to_s.empty?
self[key] = self[key] + separator + value.to_s
else
@@ -401,8 +401,8 @@ def append key, value, separator = ' '
end
end
end
- def prepend key, value, separator = ' '
- [*key].each do |key|
+ def prepend keys, value, separator = ' '
+ Array(keys).each do |key|
unless self[key].to_s.empty?
self[key] = value.to_s + separator + self[key]
else
@@ -413,8 +413,8 @@ def prepend key, value, separator = ' '
def prepend_path key, path
prepend key, path, ':' if File.directory? path
end
- def remove key, value
- [*key].each do |key|
+ def remove keys, value
+ Array(keys).each do |key|
next unless self[key]
self[key] = self[key].sub(value, '')
delete(key) if self[key].to_s.empty?
View
6 Library/Homebrew/keg.rb
@@ -36,9 +36,9 @@ def unlink
# of files and directories linked
$n=$d=0
- TOP_LEVEL_DIRECTORIES.map{ |d| self/d }.each do |src|
- next unless src.exist?
- src.find do |src|
+ TOP_LEVEL_DIRECTORIES.map{ |d| self/d }.each do |dir|
+ next unless dir.exist?
+ dir.find do |src|
next if src == self
dst=HOMEBREW_PREFIX+src.relative_path_from(self)
dst.extend ObserverPathnameExtension
View
4 Library/Homebrew/utils.rb
@@ -199,8 +199,8 @@ def archs_for_command cmd
Pathname.new(cmd).archs
end
-def inreplace path, before=nil, after=nil
- [*path].each do |path|
+def inreplace paths, before=nil, after=nil
+ Array(paths).each do |path|
f = File.open(path, 'r')
s = f.read
Please sign in to comment.
Something went wrong with that request. Please try again.