aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorJack Nagel2013-08-14 14:13:03 -0500
committerJack Nagel2013-08-14 14:13:03 -0500
commit7ddc432c9e55ea4a2f3244d95c2d0d3b39fa4e90 (patch)
treed25ddcb3994ced8a7f205a28c33e70dc44ff8f85 /Library/Homebrew
parentd77240a98c8bf7a59bc62140c27d2ce19d0150e9 (diff)
downloadbrew-7ddc432c9e55ea4a2f3244d95c2d0d3b39fa4e90.tar.bz2
Replace long conditional with guard clauses
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/python_helper.rb14
1 files changed, 5 insertions, 9 deletions
diff --git a/Library/Homebrew/python_helper.rb b/Library/Homebrew/python_helper.rb
index 3fd501bb2..c99fce2c7 100644
--- a/Library/Homebrew/python_helper.rb
+++ b/Library/Homebrew/python_helper.rb
@@ -35,15 +35,11 @@ def python_helper(options={:allowed_major_versions => [2, 3]}, &block)
filtered_python_reqs = []
while !python_reqs.empty?
py = python_reqs.shift
- # this is ulgy but Ruby 1.8 has no `uniq! { }`
- if !filtered_python_reqs.map{ |fpr| fpr.binary }.include?(py.binary) &&
- py.satisfied? &&
- options[:allowed_major_versions].include?(py.version.major) &&
- # if optional or recommended then check the build.with?
- (self.build.with?(py.name) || !(py.optional? || py.recommended?))
- then
- filtered_python_reqs << py
- end
+ next if filtered_python_reqs.any? { |req| req.binary == py.binary }
+ next unless py.satisfied?
+ next unless options[:allowed_major_versions].include?(py.version.major)
+ next if (py.optional? || py.recommended?) && build.without?(py.name)
+ filtered_python_reqs << py
end
# Allow to use an else-branch like so: `if python do ... end; else ... end`