From 903a3c05c16e8e1beafeaa0af39b9cb78370c01b Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sun, 3 Aug 2014 13:12:59 -0500 Subject: Eliminate a nil check --- Library/Homebrew/compilers.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'Library/Homebrew/compilers.rb') diff --git a/Library/Homebrew/compilers.rb b/Library/Homebrew/compilers.rb index 95faa4415..93c52c343 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 = { -- cgit v1.2.3