aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/requirement.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-18 21:29:41 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-18 21:29:41 +0000
commit95683e5cb2d1ab8351402b09ef853dcdf875bf8d (patch)
tree44500dba22e9aa94ecc5d4fd348512d0fb236501 /lib/rubygems/requirement.rb
parent81629f05312cc4df2193a17f13c581eda174d9af (diff)
downloadruby-95683e5cb2d1ab8351402b09ef853dcdf875bf8d.tar.gz
* lib/rubygems: Update to RubyGems 2.2.0.preview.1
This brings several new features to RubyGems summarized here: https://github.com/rubygems/rubygems/blob/v2.2.0.preview.1/History.txt * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/requirement.rb')
-rw-r--r--lib/rubygems/requirement.rb22
1 files changed, 4 insertions, 18 deletions
diff --git a/lib/rubygems/requirement.rb b/lib/rubygems/requirement.rb
index ed768924a8..4bf1ed914f 100644
--- a/lib/rubygems/requirement.rb
+++ b/lib/rubygems/requirement.rb
@@ -1,13 +1,3 @@
-##
-# A Requirement is a set of one or more version restrictions. It supports a
-# few (<tt>=, !=, >, <, >=, <=, ~></tt>) different restriction operators.
-
-# REFACTOR: The fact that a requirement is singular or plural is kind of
-# awkward. Is Requirement the right name for this? Or should it be one
-# [op, number] pair, and we call the list of requirements something else?
-# Since a Requirement is held by a Dependency, maybe this should be made
-# singular and the list aspect should be pulled up into Dependency?
-
require "rubygems/version"
require "rubygems/deprecate"
@@ -15,6 +5,10 @@ require "rubygems/deprecate"
# load our yaml + workarounds now.
Gem.load_yaml if defined? ::YAML
+##
+# A Requirement is a set of one or more version restrictions. It supports a
+# few (<tt>=, !=, >, <, >=, <=, ~></tt>) different restriction operators.
+
class Gem::Requirement
OPS = { #:nodoc:
"=" => lambda { |v, r| v == r },
@@ -41,9 +35,6 @@ class Gem::Requirement
# If the input is "weird", the default version requirement is
# returned.
- # REFACTOR: There's no reason that this can't be unified with .new.
- # .new is the standard Ruby factory method.
-
def self.create input
case input
when Gem::Requirement then
@@ -78,11 +69,6 @@ class Gem::Requirement
# parse("1.0") # => ["=", "1.0"]
# parse(Gem::Version.new("1.0")) # => ["=, "1.0"]
- # REFACTOR: Little two element arrays like this have no real semantic
- # value. I'd love to see something like this:
- # Constraint = Struct.new(:operator, :version); (or similar)
- # and have a Requirement be a list of Constraints.
-
def self.parse obj
return ["=", obj] if Gem::Version === obj