class Composer::Semver::Comparator
Public Class Methods
Evaluates the expression: version1 operator version2.
@param version1 The version 1 string. @param operator The operator to perform the comparison. @param version2 The version 2 string.
@return bool
# 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
Evaluates the expression: version1 == version2.
@param version1 The version 1 string. @param version2 The version 2 string.
@return bool
# File lib/composer/semver/comparator.rb, line 62 def equal_to?(version1, version2) self::compare?(version1, '==', version2) end
Evaluates the expression: version1 > version2.
@param version1 The version 1 string. @param version2 The version 2 string.
@return bool
# File lib/composer/semver/comparator.rb, line 22 def greater_than?(version1, version2) self::compare?(version1, '>', version2) end
Evaluates the expression: version1 >= version2.
@param version1 The version 1 string. @param version2 The version 2 string.
@return bool
# File lib/composer/semver/comparator.rb, line 32 def greater_than_or_equal_to?(version1, version2) self::compare?(version1, '>=', version2) end
Evaluates the expression: version1 < version2.
@param version1 The version 1 string. @param version2 The version 2 string.
@return bool
# File lib/composer/semver/comparator.rb, line 42 def less_than?(version1, version2) self::compare?(version1, '<', version2) end
Evaluates the expression: version1 <= version2.
@param version1 The version 1 string. @param version2 The version 2 string.
@return bool
# File lib/composer/semver/comparator.rb, line 52 def less_than_or_equal_to?(version1, version2) self::compare?(version1, '<=', version2) end
Evaluates the expression: version1 != version2.
@param version1 The version 1 string. @param version2 The version 2 string.
@return bool
# File lib/composer/semver/comparator.rb, line 72 def not_equal_to?(version1, version2) self::compare?(version1, '!=', version2) end