semantic_compare
SemanticCompare
Compare semver versions using semantic expressions.
Most of the npm's semver implementation expressions are supported.
This library is based on stdlib's SemanticVersion.
Documentation
https://j8r.github.io/semantic_compare
Installation
Add the dependency to your shard.yml
:
dependencies:
semantic_compare:
github: j8r/semantic_compare
Usage
Compare with simple expressions
require "semantic_compare"
semantic_version = SemanticVersion.new "1.2.3"
SemanticCompare.simple_expression semantic_version, "<1.5.0" #=> true
SemanticCompare.simple_expression semantic_version, "1.2.0 - 1.4.0" #=> true
Compare with complex expressions, which can include 'or' ||
signs
require "semantic_compare"
# Compare with simple expressions
semantic_version = SemanticVersion.new "1.2.3"
SemanticCompare.complex_expression semantic_version, ">1.2.3 <2.0.0" #=> true
SemanticCompare.complex_expression semantic_version, ">=1.0.4 || <2.0.0 || ~1.2.1" #=> true
License
Copyright (c) 2017-2020 Julien Reichardt - ISC License
Repository
semantic_compare
Owner
Statistic
- 5
- 0
- 1
- 2
- 0
- over 4 years ago
- October 11, 2017
License
ISC License
Links
Synced at
Wed, 20 Nov 2024 20:58:56 GMT
Languages