aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/compilers.rb
diff options
context:
space:
mode:
authorJack Nagel2014-08-03 13:12:59 -0500
committerJack Nagel2014-08-03 13:14:50 -0500
commit903a3c05c16e8e1beafeaa0af39b9cb78370c01b (patch)
tree4c3aa1b07b6345f14f9733375f2a65b1bf0bf085 /Library/Homebrew/compilers.rb
parent15881a91a8a2e7cabd2dcb34da5afd6d6a7589fd (diff)
downloadhomebrew-903a3c05c16e8e1beafeaa0af39b9cb78370c01b.tar.bz2
Eliminate a nil check
Diffstat (limited to 'Library/Homebrew/compilers.rb')
-rw-r--r--Library/Homebrew/compilers.rb13
1 files changed, 11 insertions, 2 deletions
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 = {