summaryrefslogtreecommitdiff
path: root/lib/rubygems/platform.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-17 22:04:18 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-17 22:04:18 +0000
commit9d4f37f51fb2ffdef5e318afb3cb81516dcba4f7 (patch)
tree2eb3c16c59259a25f5d9315edacc61dfc8c59d62 /lib/rubygems/platform.rb
parentf98e6b91dec68ddd010ccb3bad651a18e7dca338 (diff)
Update RubyGems to 1.1.1 r1778 (almost 1.2)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/platform.rb')
-rw-r--r--lib/rubygems/platform.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb
index 7abc15ef94..5e932cd592 100644
--- a/lib/rubygems/platform.rb
+++ b/lib/rubygems/platform.rb
@@ -1,7 +1,8 @@
require 'rubygems'
+##
# Available list of platforms for targeting Gem installations.
-#
+
class Gem::Platform
@local = nil
@@ -122,11 +123,20 @@ class Gem::Platform
to_a.compact.join '-'
end
+ ##
+ # Is +other+ equal to this platform? Two platforms are equal if they have
+ # the same CPU, OS and version.
+
def ==(other)
self.class === other and
@cpu == other.cpu and @os == other.os and @version == other.version
end
+ ##
+ # Does +other+ match this platform? Two platforms match if they have the
+ # same CPU, or either has a CPU of 'universal', they have the same OS, and
+ # they have the same version, or either has no version.
+
def ===(other)
return nil unless Gem::Platform === other
@@ -140,6 +150,10 @@ class Gem::Platform
(@version.nil? or other.version.nil? or @version == other.version)
end
+ ##
+ # Does +other+ match this platform? If +other+ is a String it will be
+ # converted to a Gem::Platform first. See #=== for matching rules.
+
def =~(other)
case other
when Gem::Platform then # nop