Reduce nesting and remove extra whitespace in python_helper

This commit is contained in:
Adam Vandenberg 2013-07-02 10:19:31 -07:00
parent 5db5740cc2
commit eafa7a141d

View File

@ -1,4 +1,3 @@
# This is used in the Formula class when the user calls # This is used in the Formula class when the user calls
# `python`, `python2` or `python3`. # `python`, `python2` or `python3`.
@ -19,11 +18,12 @@ def python_helper(options={:allowed_major_versions => [2, 3]}, &block)
# We are already inside of a `python do ... end` block, so just return # We are already inside of a `python do ... end` block, so just return
# the current_python or false if the version.major is not allowed. # the current_python or false if the version.major is not allowed.
if options[:allowed_major_versions].include?(@current_python.version.major) if options[:allowed_major_versions].include?(@current_python.version.major)
@current_python return @current_python
else else
false return false
end end
else end
# Look for PythonInstalled requirements for this formula # Look for PythonInstalled requirements for this formula
python_reqs = requirements.select{ |r| r.kind_of?(PythonInstalled) } python_reqs = requirements.select{ |r| r.kind_of?(PythonInstalled) }
if python_reqs.empty? if python_reqs.empty?
@ -88,4 +88,3 @@ def python_helper(options={:allowed_major_versions => [2, 3]}, &block)
end end
end end
end end
end # enf of python_helper method