diff options
| author | Jack Nagel | 2013-06-15 19:39:27 -0500 | 
|---|---|---|
| committer | Jack Nagel | 2013-06-15 19:39:27 -0500 | 
| commit | 1d293265582fe59806fca45ae711b556680fbcf3 (patch) | |
| tree | aa655b80be6bb261cc06bea7fbe30f15559db3cd | |
| parent | ee87c8c82128658b97b9fef66cd164658608a142 (diff) | |
| download | homebrew-1d293265582fe59806fca45ae711b556680fbcf3.tar.bz2 | |
Add MacOS::Version.from_symbol
| -rw-r--r-- | Library/Homebrew/os/mac/version.rb | 22 | 
1 files changed, 14 insertions, 8 deletions
diff --git a/Library/Homebrew/os/mac/version.rb b/Library/Homebrew/os/mac/version.rb index cc1d65cfa..6e841cf65 100644 --- a/Library/Homebrew/os/mac/version.rb +++ b/Library/Homebrew/os/mac/version.rb @@ -2,15 +2,21 @@ require 'version'  module MacOS    class Version < ::Version +    SYMBOLS = { +      :mavericks     => '10.9', +      :mountain_lion => '10.8', +      :lion          => '10.7', +      :snow_leopard  => '10.6', +      :leopard       => '10.5', +      :tiger         => '10.4', +    } + +    def self.from_symbol(sym) +      new(SYMBOLS.fetch(sym)) +    end +      def <=>(other) -      v = case other -          when :mountain_lion then "10.8" -          when :lion          then "10.7" -          when :snow_leopard  then "10.6" -          when :leopard       then "10.5" -          when :tiger         then "10.4" -          else other.to_s -          end +      v = SYMBOLS.fetch(other, other.to_s)        super(Version.new(v))      end  | 
