semantic 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/semantic.rb +1 -1
- data/lib/semantic/version.rb +12 -0
- data/spec/version_spec.rb +19 -0
- metadata +1 -1
data/lib/semantic.rb
CHANGED
data/lib/semantic/version.rb
CHANGED
@@ -53,6 +53,18 @@ class Semantic::Version
|
|
53
53
|
if (self <=> other_version) == -1 then true else false end
|
54
54
|
end
|
55
55
|
|
56
|
+
def >= other_version
|
57
|
+
if (self <=> other_version) >= 0 then true else false end
|
58
|
+
end
|
59
|
+
|
60
|
+
def <= other_version
|
61
|
+
if (self <=> other_version) <= 0 then true else false end
|
62
|
+
end
|
63
|
+
|
64
|
+
def == other_version
|
65
|
+
if (self <=> other_version) == 0 then true else false end
|
66
|
+
end
|
67
|
+
|
56
68
|
private
|
57
69
|
|
58
70
|
def compare_recursively ary1, ary2
|
data/spec/version_spec.rb
CHANGED
@@ -96,6 +96,25 @@ describe Semantic::Version do
|
|
96
96
|
@v4.should < @v2
|
97
97
|
@v3.should < @v4
|
98
98
|
end
|
99
|
+
|
100
|
+
it "determines whether it is greater than or equal to another instance" do
|
101
|
+
@v1.should >= @v1
|
102
|
+
@v1.should_not >= @v2
|
103
|
+
@v4.should >= @v3
|
104
|
+
@v2.should >= @v4
|
105
|
+
end
|
106
|
+
|
107
|
+
it "determines whether it is less than or equal to another instance" do
|
108
|
+
@v1.should <= @v2
|
109
|
+
@v4.should_not <= $v3
|
110
|
+
@v2.should <= @v2
|
111
|
+
@v3.should_not <= @v1
|
112
|
+
end
|
113
|
+
|
114
|
+
it "determines whether it is exactly equal to another instance" do
|
115
|
+
@v1.should == @v1.dup
|
116
|
+
@v2.should == @v2.dup
|
117
|
+
end
|
99
118
|
end
|
100
119
|
|
101
120
|
context "type coercions" do
|