diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-09 23:21:36 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-09 23:21:36 +0000 |
commit | 47f0248b0858898dd24d1e654cedf174059ca677 (patch) | |
tree | 493e84160f8609db408d88349f0624a3ff92c3c2 /lib/rubygems/name_tuple.rb | |
parent | cd9f9e471977447a991ced4ea38efb2309459ef5 (diff) | |
download | ruby-47f0248b0858898dd24d1e654cedf174059ca677.tar.gz |
* lib/rubygems: Import RubyGems 2.1
* test/rubygems: Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/name_tuple.rb')
-rw-r--r-- | lib/rubygems/name_tuple.rb | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/lib/rubygems/name_tuple.rb b/lib/rubygems/name_tuple.rb index d16fad26f1..f16ab369fa 100644 --- a/lib/rubygems/name_tuple.rb +++ b/lib/rubygems/name_tuple.rb @@ -43,6 +43,20 @@ class Gem::NameTuple end ## + # Returns the full name (name-version) of this Gem. Platform information is + # included if it is not the default Ruby platform. This mimics the behavior + # of Gem::Specification#full_name. + + def full_name + case @platform + when nil, 'ruby', '' + "#{@name}-#{@version}" + else + "#{@name}-#{@version}-#{@platform}" + end + end + + ## # Indicate if this NameTuple matches the current platform. def match_platform? @@ -59,12 +73,7 @@ class Gem::NameTuple # Return the name that the gemspec file would be def spec_name - case @platform - when nil, 'ruby', '' - "#{@name}-#{@version}.gemspec" - else - "#{@name}-#{@version}-#{@platform}.gemspec" - end + "#{full_name}.gemspec" end ## @@ -74,10 +83,12 @@ class Gem::NameTuple [@name, @version, @platform] end - def to_s + def inspect # :nodoc: "#<Gem::NameTuple #{@name}, #{@version}, #{@platform}>" end + alias to_s inspect # :nodoc: + def <=> other to_a <=> other.to_a end |