ar-enums 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/ar_enums/base.rb +5 -0
- data/lib/ar_enums/version.rb +1 -1
- data/spec/ar_enums/base_spec.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76780917d22a19979bf55349df98c76f027b56f2
|
4
|
+
data.tar.gz: 684f4dd21c88e5afa078899e2fbd1b2a7c51e9a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4008e4235652e4079b753a12f7c06cabbe0f415699ce6ed1af4ae9845b8f13065c8a08b8d159a2dbb0b1e27c81fcb97edac660a960698221ce37df18c7b62a9
|
7
|
+
data.tar.gz: 77fdae95b57878bf048128c3452cbdf7143b6547562c66d8498df7b3e752bda42fe41020449b4468ff976dff757ff4f3c6610578713cefb66e4c79c25b1f9fe8
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ar-enums (2.0.
|
4
|
+
ar-enums (2.0.1)
|
5
5
|
activerecord (>= 3.1.0)
|
6
6
|
rake
|
7
7
|
|
@@ -43,7 +43,7 @@ GEM
|
|
43
43
|
rspec-expectations (2.4.0)
|
44
44
|
diff-lcs (~> 1.1.2)
|
45
45
|
rspec-mocks (2.4.0)
|
46
|
-
sqlite3 (1.3.
|
46
|
+
sqlite3 (1.3.9)
|
47
47
|
thor (0.19.1)
|
48
48
|
thread_safe (0.3.4)
|
49
49
|
tzinfo (1.2.1)
|
data/lib/ar_enums/base.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module ArEnums
|
2
2
|
class Base
|
3
|
+
include Comparable
|
3
4
|
extend OptionsHelper
|
4
5
|
|
5
6
|
attr_reader :id, :name, :extra_columns
|
@@ -31,6 +32,10 @@ module ArEnums
|
|
31
32
|
def hash
|
32
33
|
id.hash
|
33
34
|
end
|
35
|
+
|
36
|
+
def <=> other
|
37
|
+
id <=> other.id
|
38
|
+
end
|
34
39
|
|
35
40
|
def to_s
|
36
41
|
try_labelize(self, :desc) || try_labelize(name, :titleize)
|
data/lib/ar_enums/version.rb
CHANGED
data/spec/ar_enums/base_spec.rb
CHANGED
@@ -67,4 +67,9 @@ describe "Enum" do
|
|
67
67
|
it "should work with sets" do
|
68
68
|
Set.new([Color[:red]]).intersection(Set.new([Color[:red].dup])).should have(1).item
|
69
69
|
end
|
70
|
+
|
71
|
+
it "should be sortable" do
|
72
|
+
[Color[:green], Color[:red]].sort.should == [Color[:red], Color[:green]]
|
73
|
+
end
|
74
|
+
|
70
75
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar-enums
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emmanuel Nicolau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|