Class: Composer::Semver::Comparator
- Inherits:
-
Object
- Object
- Composer::Semver::Comparator
- Defined in:
- lib/composer/semver/comparator.rb
Class Method Summary collapse
-
.compare?(version1, operator, version2) ⇒ Boolean
Evaluates the expression: version1 operator version2.
-
.equal_to?(version1, version2) ⇒ Boolean
Evaluates the expression: version1 == version2.
-
.greater_than?(version1, version2) ⇒ Boolean
Evaluates the expression: version1 > version2.
-
.greater_than_or_equal_to?(version1, version2) ⇒ Boolean
Evaluates the expression: version1 >= version2.
-
.less_than?(version1, version2) ⇒ Boolean
Evaluates the expression: version1 < version2.
-
.less_than_or_equal_to?(version1, version2) ⇒ Boolean
Evaluates the expression: version1 <= version2.
-
.not_equal_to?(version1, version2) ⇒ Boolean
Evaluates the expression: version1 != version2.
Class Method Details
.compare?(version1, operator, version2) ⇒ Boolean
Evaluates the expression: version1 operator version2.
83 84 85 86 |
# File 'lib/composer/semver/comparator.rb', line 83 def compare?(version1, operator, version2) constraint = ::Composer::Semver::Constraint::Constraint.new(operator, version2) constraint.matches?(::Composer::Semver::Constraint::Constraint.new('==', version1)) end |
.equal_to?(version1, version2) ⇒ Boolean
Evaluates the expression: version1 == version2.
62 63 64 |
# File 'lib/composer/semver/comparator.rb', line 62 def equal_to?(version1, version2) self::compare?(version1, '==', version2) end |
.greater_than?(version1, version2) ⇒ Boolean
Evaluates the expression: version1 > version2.
22 23 24 |
# File 'lib/composer/semver/comparator.rb', line 22 def greater_than?(version1, version2) self::compare?(version1, '>', version2) end |
.greater_than_or_equal_to?(version1, version2) ⇒ Boolean
Evaluates the expression: version1 >= version2.
32 33 34 |
# File 'lib/composer/semver/comparator.rb', line 32 def greater_than_or_equal_to?(version1, version2) self::compare?(version1, '>=', version2) end |
.less_than?(version1, version2) ⇒ Boolean
Evaluates the expression: version1 < version2.
42 43 44 |
# File 'lib/composer/semver/comparator.rb', line 42 def less_than?(version1, version2) self::compare?(version1, '<', version2) end |
.less_than_or_equal_to?(version1, version2) ⇒ Boolean
Evaluates the expression: version1 <= version2.
52 53 54 |
# File 'lib/composer/semver/comparator.rb', line 52 def less_than_or_equal_to?(version1, version2) self::compare?(version1, '<=', version2) end |
.not_equal_to?(version1, version2) ⇒ Boolean
Evaluates the expression: version1 != version2.
72 73 74 |
# File 'lib/composer/semver/comparator.rb', line 72 def not_equal_to?(version1, version2) self::compare?(version1, '!=', version2) end |