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 CHANGED
@@ -8,7 +8,7 @@ GEM
8
8
  git (>= 1.2.5)
9
9
  rake
10
10
  rake (0.9.2)
11
- riot (0.12.4)
11
+ riot (0.12.5)
12
12
  rr
13
13
  rr (1.0.4)
14
14
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
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.compare(value[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.2.2"
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-09-08"
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.2.2
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-09-08 00:00:00.000000000 Z
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: &15598800 !ruby/object:Gem::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: *15598800
24
+ version_requirements: *26148260
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &15597860 !ruby/object:Gem::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: *15597860
35
+ version_requirements: *26145300
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: jeweler
38
- requirement: &15596440 !ruby/object:Gem::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: *15596440
46
+ version_requirements: *26144780
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: riot
49
- requirement: &15595620 !ruby/object:Gem::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: *15595620
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: 4342661046758665632
91
+ hash: -225028042708857402
92
92
  required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  none: false
94
94
  requirements: