summaryrefslogtreecommitdiff
path: root/lib/rubygems/requirement.rb
diff options
context:
space:
mode:
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