From eb528fd7cd01baac4fb0bcdf13ab2c0ab8f6c568 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sun, 3 Aug 2014 13:12:59 -0500 Subject: [PATCH] Eliminate a nil check --- Library/Homebrew/compilers.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/compilers.rb b/Library/Homebrew/compilers.rb index 95faa44159..93c52c3436 100644 --- a/Library/Homebrew/compilers.rb +++ b/Library/Homebrew/compilers.rb @@ -3,7 +3,16 @@ module CompilerConstants GNU_GCC_REGEXP = /^gcc-(4\.[3-9])$/ end -Compiler = Struct.new(:name, :version, :priority) +# TODO make this class private to CompilerSelector +class Compiler + attr_reader :name, :version, :priority + + def initialize(name, version=0, priority=0) + @name = name + @version = version + @priority = priority + end +end class CompilerFailure attr_reader :name @@ -40,7 +49,7 @@ class CompilerFailure end def ===(compiler) - name == compiler.name && version >= (compiler.version || 0) + name == compiler.name && version >= compiler.version end MESSAGES = {