Class: Capsium::Package::VersionRange
- Inherits:
-
Object
- Object
- Capsium::Package::VersionRange
- Defined in:
- lib/capsium/package/version.rb,
sig/capsium/package/version.rbs
Overview
A semver range for metadata.dependencies (ARCHITECTURE.md section 4a): "*", exact versions, wildcards/partials, caret, tilde, comparison operators and comma/space conjunctions.
Constant Summary collapse
- NUMERIC_PART =
/\A(\d+)(?:\.(\d+)|\.(?:x|X|\*))?(?:\.(?:\d+|x|X|\*))?(?:-[^\s,]+)?\z/- WILDCARD_PART =
/\A(?:x|X|\*)\z/
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(bounds) ⇒ VersionRange
constructor
A new instance of VersionRange.
- #satisfied_by?(version) ⇒ Boolean
Constructor Details
#initialize(bounds) ⇒ VersionRange
Returns a new instance of VersionRange.
182 183 184 |
# File 'lib/capsium/package/version.rb', line 182 def initialize(bounds) @bounds = bounds end |
Class Method Details
.parse(string) ⇒ VersionRange
88 89 90 91 92 93 |
# File 'lib/capsium/package/version.rb', line 88 def self.parse(string) terms = string.to_s.strip.split(/[,\s]+/).reject(&:empty?) return new([[">=", Version.new(0, 0, 0)]]) if terms.empty? || terms == ["*"] new(terms.flat_map { |term| (term) }) end |