Class | Gem::Requirement
In: | lib/rubygems/requirement.rb
Parent: | Object

Requirement version includes a prefaced comparator in addition to a version number.

A Requirement object can actually contain multiple, er, requirements, as in (> 1.2, < 2.0).

### Methods

as_list create default new normalize parse satisfied_by? satisfy?

### Included Modules

Comparable

### Constants

OPS | = | { "=" => lambda { |v, r| v == r }, "!=" => lambda { |v, r| v != r }, ">" => lambda { |v, r| v > r }, "<" => lambda { |v, r| v < r }, ">=" => lambda { |v, r| v >= r }, "<=" => lambda { |v, r| v <= r }, "~>" => lambda { |v, r| v >= r && v < r.bump }
OP_RE | = | /#{OPS.keys.map{ |k| Regexp.quote k }.join '|'}/o

### Attributes

requirements | [R] |

### Public Class methods

create(input)

Factory method to create a Gem::Requirement object. Input may be a Version, a String, or nil. Intended to simplify client code.

If the input is "weird", the default version requirement is returned.

default()

A default "version requirement" can surely only be ’>= 0’.

new(requirements)

Constructs a Requirement from `requirements` which can be a String, a Gem::Version, or an Array of those. See parse for details on the formatting of requirement strings.

### Public Instance methods

as_list()
normalize()
parse(obj)

Parse the version requirement obj returning the operator and version.

The requirement can be a String or a Gem::Version. A String can be an operator (<, <=, =, =>, >, !=, ~>), a version number, or both, operator first.

satisfied_by?(version)

True if this requirement satisfied by the Gem::Version `version`.

satisfy?(op, version, required_version)

Is "`version` `op` `required_version`" satisfied?

[Validate]