renum 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/lib/renum/enumerated_value.rb +2 -4
- data/lib/renum/version.rb +1 -1
- data/spec/renum_spec.rb +10 -0
- metadata +2 -2
data/History.txt
CHANGED
@@ -17,9 +17,11 @@ module Renum
|
|
17
17
|
|
18
18
|
include Comparable
|
19
19
|
attr_reader :name
|
20
|
+
attr_reader :index
|
20
21
|
|
21
22
|
def initialize name
|
22
23
|
@name = name.to_s
|
24
|
+
@index = self.class.values.size
|
23
25
|
self.class.values << self
|
24
26
|
end
|
25
27
|
|
@@ -27,10 +29,6 @@ module Renum
|
|
27
29
|
"#{self.class}::#{name}"
|
28
30
|
end
|
29
31
|
|
30
|
-
def index
|
31
|
-
self.class.values.index self
|
32
|
-
end
|
33
|
-
|
34
32
|
def <=> other
|
35
33
|
index <=> other.index
|
36
34
|
end
|
data/lib/renum/version.rb
CHANGED
data/spec/renum_spec.rb
CHANGED
@@ -95,4 +95,14 @@ describe "enum with no values array and values declared in the block" do
|
|
95
95
|
it "supprts there being no extra data and no init() method defined, if you don't need them" do
|
96
96
|
HairColor::BLONDE.name.should == "BLONDE"
|
97
97
|
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# It was reported on my blog that <=> was causing segfaults.
|
101
|
+
# I'd love to figure out why, but first I'd love to fix that.
|
102
|
+
describe "digging into this segfault/illegal instruction issue, renum" do
|
103
|
+
it "doesn't cause the ruby process to bomb!" do
|
104
|
+
Color::RED.should < Color::GREEN
|
105
|
+
Color::RED.should_not > Color::GREEN
|
106
|
+
Color::RED.should < Color::BLUE
|
107
|
+
end
|
98
108
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: renum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Hume
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-05-15 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|