Skip to content
Snippets Groups Projects
Commit 7fbeb0df authored by Jack Nagel's avatar Jack Nagel
Browse files

MacOSVersion -> MacOS::Version

parent b41bb64c
No related branches found
No related tags found
No related merge requests found
require 'macos/version'
module MacOS extend self
# This can be compared to numerics, strings, or symbols
# using the standard Ruby Comparable methods.
def version
require 'version'
MacOSVersion.new(MACOS_VERSION.to_s)
Version.new(MACOS_VERSION)
end
def cat
......
require 'version'
module MacOS
class Version < ::Version
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
else other.to_s
end
super(Version.new(v))
end
end
end
require 'testing_env'
require 'version'
require 'macos/version'
class MacOSVersionTests < Test::Unit::TestCase
def setup
@v = MacOSVersion.new(10.7)
@v = MacOS::Version.new(10.7)
end
def test_compare_with_symbol
......
......@@ -208,17 +208,3 @@ class VersionSchemeDetector
raise "Unknown version scheme #{@scheme} was requested."
end
end
# Enable things like "MacOS.version >= :lion"
class MacOSVersion < Version
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
else other.to_s
end
super(Version.new(v))
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment