ruby-version 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/lib/ruby-version.rb +13 -3
- data/ruby-version.gemspec +2 -2
- data/test +3 -0
- metadata +11 -11
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/lib/ruby-version.rb
CHANGED
@@ -108,6 +108,17 @@ module Ruby
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
+
##
|
112
|
+
# Alias for {#compare}.
|
113
|
+
#
|
114
|
+
# @param [String, Symbol, Array] value version identifier
|
115
|
+
# @return [Boolean] +1+ if this one is higher, +-1+ if lower and +0+ otherwise
|
116
|
+
#
|
117
|
+
|
118
|
+
def self.<=>(value)
|
119
|
+
self.compare(value)
|
120
|
+
end
|
121
|
+
|
111
122
|
##
|
112
123
|
# Brokes string identifier to numeric tokens in array.
|
113
124
|
#
|
@@ -118,8 +129,7 @@ module Ruby
|
|
118
129
|
def self.broke(string)
|
119
130
|
string.to_s.split(".").map! { |i| i.to_i }
|
120
131
|
end
|
121
|
-
|
122
|
-
|
132
|
+
|
123
133
|
##
|
124
134
|
# Contents frozen tokens array of the current ruby version.
|
125
135
|
# @see VERSION
|
@@ -138,7 +148,7 @@ module Ruby
|
|
138
148
|
end
|
139
149
|
|
140
150
|
self::TOKENS.each_index do |i|
|
141
|
-
case self::TOKENS[i].to_i
|
151
|
+
case self::TOKENS[i].to_i <=> value[i].to_i
|
142
152
|
when -1
|
143
153
|
return lower
|
144
154
|
when 1
|
data/ruby-version.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "ruby-version"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Martin Koz\u{e1}k"]
|
12
|
-
s.date = "2011-
|
12
|
+
s.date = "2011-10-07"
|
13
13
|
s.email = "martinkozak@martinkozak.net"
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
data/test
CHANGED
@@ -26,6 +26,9 @@ context "Ruby::Version" do
|
|
26
26
|
asserts("#>=") do
|
27
27
|
not Ruby::Version >= UP and Ruby::Version >= DOWN and Ruby::Version >= CURRENT
|
28
28
|
end
|
29
|
+
asserts("#<=>") do
|
30
|
+
(Ruby::Version <=> UP) == -1 and (Ruby::Version <=> DOWN) == 1 and (Ruby::Version <=> CURRENT) == 0
|
31
|
+
end
|
29
32
|
asserts("#TOKENS") do
|
30
33
|
Ruby::Version::TOKENS == Ruby::Version::broke(RUBY_VERSION)
|
31
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-version
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-10-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hash-utils
|
16
|
-
requirement: &
|
16
|
+
requirement: &26148260 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.17.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *26148260
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &26145300 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.0.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *26145300
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: jeweler
|
38
|
-
requirement: &
|
38
|
+
requirement: &26144780 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.5.2
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *26144780
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: riot
|
49
|
-
requirement: &
|
49
|
+
requirement: &26144260 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: 0.12.3
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *26144260
|
58
58
|
description:
|
59
59
|
email: martinkozak@martinkozak.net
|
60
60
|
executables: []
|
@@ -88,7 +88,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
88
|
version: '0'
|
89
89
|
segments:
|
90
90
|
- 0
|
91
|
-
hash:
|
91
|
+
hash: -225028042708857402
|
92
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
93
|
none: false
|
94
94
|
requirements:
|