sem_version 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/sem_version.rb +8 -1
  2. metadata +1 -1
data/lib/sem_version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  class SemVersion
2
2
  include Comparable
3
3
 
4
- VERSION = '1.1.0'
4
+ VERSION = '1.2.0'
5
5
  # Pattern allows min and patch to be skipped. We have to do extra checking if we want them
6
6
  SEMVER_REGEX = /^(\d+)(?:\.(\d+)(?:\.(\d+)(?:-([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?(?:\+([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?)?)?$/
7
7
 
@@ -91,6 +91,13 @@ class SemVersion
91
91
  !['=', '=='].include?(comparison) && !version.nil?
92
92
  end
93
93
 
94
+ def self.split_constraint(constraint)
95
+ comparison, version = constraint.strip.split(' ', 2)
96
+ comparison, version = '=', comparison if version.nil?
97
+ comparison = '=' if comparison == '=='
98
+ [comparison, version]
99
+ end
100
+
94
101
  def major=(val)
95
102
  raise ArgumentError, "#{val} is not a valid major version (must be an integer >= 0)" unless val.is_a?(Fixnum) && val >= 0
96
103
  @major = val
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sem_version
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: