Combine conditionals

This commit is contained in:
Jack Nagel 2014-06-16 16:57:55 -05:00
parent be1822dd72
commit 9d030f8397

View File

@ -45,21 +45,16 @@ class CompilerFailure
end end
def initialize compiler, &block def initialize compiler, &block
instance_eval(&block) if block_given?
# Non-Apple compilers are in the format fails_with compiler => version # Non-Apple compilers are in the format fails_with compiler => version
if compiler.is_a? Hash if compiler.is_a? Hash
# currently the only compiler for this case is GCC # currently the only compiler for this case is GCC
_, @major_version = compiler.first _, @major_version = compiler.first
@compiler = 'gcc-' + @major_version @compiler = 'gcc-' + @major_version
else
@compiler = compiler
end
instance_eval(&block) if block_given?
if compiler.is_a? Hash
# so fails_with :gcc => '4.8' simply marks all 4.8 releases incompatible # so fails_with :gcc => '4.8' simply marks all 4.8 releases incompatible
@version ||= @major_version + '.999' @version ||= @major_version + '.999'
else else
@compiler = compiler
@version ||= 9999 @version ||= 9999
@version = @version.to_i @version = @version.to_i
end end