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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c34a6a56500c6697165a3252f1509a54cbfee915
4
- data.tar.gz: 88e8e2f99106d56c1c596cf758d7f80398bac27d
3
+ metadata.gz: 76780917d22a19979bf55349df98c76f027b56f2
4
+ data.tar.gz: 684f4dd21c88e5afa078899e2fbd1b2a7c51e9a0
5
5
  SHA512:
6
- metadata.gz: f9bc984e495b93905ca602534a0248f405ec336db1d08318fef5ecb25111432e8a5c6430b4d39d5c9d68fdf201cd4dcbc8fde72f0b4cab051c8aee4411182250
7
- data.tar.gz: 09f67c296f366917fcdecc0b5d2f99405517431e10ed815aa601c5a64564d2f7e208fdd0ca3fd7eb7386715d8b901173c00e8d8c09f5c72182df554ba3ef447a
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.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.4)
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)
@@ -1,3 +1,3 @@
1
1
  module ArEnums
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
@@ -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.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-25 00:00:00.000000000 Z
11
+ date: 2014-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec