Use each instead of while loop

This commit is contained in:
Jack Nagel 2013-08-14 14:13:03 -05:00
parent 7ddc432c9e
commit c9a4e1e1c9

View File

@ -33,8 +33,7 @@ def python_helper(options={:allowed_major_versions => [2, 3]}, &block)
# check that no two python binaries are the same (which could be the case # check that no two python binaries are the same (which could be the case
# because more than one `depends_on :python => 'module_name' may be present). # because more than one `depends_on :python => 'module_name' may be present).
filtered_python_reqs = [] filtered_python_reqs = []
while !python_reqs.empty? python_reqs.each do |py|
py = python_reqs.shift
next if filtered_python_reqs.any? { |req| req.binary == py.binary } next if filtered_python_reqs.any? { |req| req.binary == py.binary }
next unless py.satisfied? next unless py.satisfied?
next unless options[:allowed_major_versions].include?(py.version.major) next unless options[:allowed_major_versions].include?(py.version.major)