homebrew-cask-versions/lib/hbc/macos/release.rb
Roland Walker 202d6019f8 Move all code under an Hbc:: namespace
* convert existing Cask:: namespace to Hbc::
* move Homebrew-fork code under Hbc::
* move freestanding classes such as Tty and TopologicalHash under Hbc::
* recast HOMEBREW_CASK_ constants as HBC_
* modify our Homebrew Formula for backward compatibility
* devscripts and dev docs
2015-01-02 07:27:03 -05:00

41 lines
933 B
Ruby

# originally from Homebrew
require 'rubygems'
module Hbc::MacOS
class Release
include Comparable
SYMBOLS = {
:yosemite => '10.10',
:mavericks => '10.9',
:mountain_lion => '10.8',
:lion => '10.7',
:snow_leopard => '10.6',
:leopard => '10.5',
:tiger => '10.4',
:panther => '10.3',
:jaguar => '10.2',
:puma => '10.1',
:cheetah => '10.0',
}
def initialize(release)
@release = Gem::Version.new(release)
end
def <=>(other)
v = Gem::Version.new(SYMBOLS.fetch(other, other.to_s))
@release <=> v
end
def to_sym
@inverted ||= SYMBOLS.invert
@inverted.fetch(@release.to_s, nil)
end
def to_s
@release.to_s
end
end
end