ar-enums 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +12 -12
- data/lib/ar_enums/enum.rb +8 -0
- data/lib/ar_enums/version.rb +1 -1
- data/spec/ar_enums/enum_spec.rb +4 -0
- metadata +60 -69
data/Gemfile.lock
CHANGED
@@ -1,32 +1,32 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ar-enums (0.3.
|
4
|
+
ar-enums (0.3.9)
|
5
5
|
activerecord
|
6
6
|
rake
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (3.0.
|
12
|
-
activesupport (= 3.0.
|
11
|
+
activemodel (3.0.10)
|
12
|
+
activesupport (= 3.0.10)
|
13
13
|
builder (~> 2.1.2)
|
14
|
-
i18n (~> 0.
|
15
|
-
activerecord (3.0.
|
16
|
-
activemodel (= 3.0.
|
17
|
-
activesupport (= 3.0.
|
18
|
-
arel (~> 2.0.
|
14
|
+
i18n (~> 0.5.0)
|
15
|
+
activerecord (3.0.10)
|
16
|
+
activemodel (= 3.0.10)
|
17
|
+
activesupport (= 3.0.10)
|
18
|
+
arel (~> 2.0.10)
|
19
19
|
tzinfo (~> 0.3.23)
|
20
|
-
activesupport (3.0.
|
20
|
+
activesupport (3.0.10)
|
21
21
|
archive-tar-minitar (0.5.2)
|
22
|
-
arel (2.0.
|
22
|
+
arel (2.0.10)
|
23
23
|
builder (2.1.2)
|
24
24
|
columnize (0.3.2)
|
25
25
|
diff-lcs (1.1.2)
|
26
26
|
i18n (0.5.0)
|
27
27
|
linecache19 (0.5.11)
|
28
28
|
ruby_core_source (>= 0.1.4)
|
29
|
-
rake (0.
|
29
|
+
rake (0.9.2.2)
|
30
30
|
rspec (2.4.0)
|
31
31
|
rspec-core (~> 2.4.0)
|
32
32
|
rspec-expectations (~> 2.4.0)
|
@@ -48,7 +48,7 @@ GEM
|
|
48
48
|
sqlite3 (1.3.3)
|
49
49
|
sqlite3-ruby (1.3.3)
|
50
50
|
sqlite3 (>= 1.3.3)
|
51
|
-
tzinfo (0.3.
|
51
|
+
tzinfo (0.3.29)
|
52
52
|
|
53
53
|
PLATFORMS
|
54
54
|
ruby
|
data/lib/ar_enums/enum.rb
CHANGED
@@ -26,6 +26,11 @@ module ActiveRecord
|
|
26
26
|
return id == other.id if other.is_a?(Enum)
|
27
27
|
[id.to_s, name].include?(other.to_s)
|
28
28
|
end
|
29
|
+
alias_method :eql?, :==
|
30
|
+
|
31
|
+
def hash
|
32
|
+
id.hash
|
33
|
+
end
|
29
34
|
|
30
35
|
def to_s
|
31
36
|
try_labelize(self, :desc) || try_labelize(name, :titleize)
|
@@ -43,6 +48,9 @@ module ActiveRecord
|
|
43
48
|
def self.[] name_or_id
|
44
49
|
all.detect { |enum| enum == name_or_id }
|
45
50
|
end
|
51
|
+
class << self
|
52
|
+
alias_method :find_by_id, :[]
|
53
|
+
end
|
46
54
|
|
47
55
|
def self.find_all_by_id ids, options = {}
|
48
56
|
all.select { |enum| ids.include? enum.id }
|
data/lib/ar_enums/version.rb
CHANGED
data/spec/ar_enums/enum_spec.rb
CHANGED
metadata
CHANGED
@@ -1,83 +1,78 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar-enums
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.9
|
4
5
|
prerelease:
|
5
|
-
version: 0.3.8
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Emmanuel Nicolau
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-11-09 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: rspec
|
18
|
-
requirement: &
|
16
|
+
requirement: &70303456837740 !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
21
|
-
- -
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
24
22
|
type: :development
|
25
23
|
prerelease: false
|
26
|
-
version_requirements: *
|
27
|
-
- !ruby/object:Gem::Dependency
|
24
|
+
version_requirements: *70303456837740
|
25
|
+
- !ruby/object:Gem::Dependency
|
28
26
|
name: ruby-debug19
|
29
|
-
requirement: &
|
27
|
+
requirement: &70303456837300 !ruby/object:Gem::Requirement
|
30
28
|
none: false
|
31
|
-
requirements:
|
32
|
-
- -
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version:
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
35
33
|
type: :development
|
36
34
|
prerelease: false
|
37
|
-
version_requirements: *
|
38
|
-
- !ruby/object:Gem::Dependency
|
35
|
+
version_requirements: *70303456837300
|
36
|
+
- !ruby/object:Gem::Dependency
|
39
37
|
name: sqlite3-ruby
|
40
|
-
requirement: &
|
38
|
+
requirement: &70303456836880 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version:
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
46
44
|
type: :development
|
47
45
|
prerelease: false
|
48
|
-
version_requirements: *
|
49
|
-
- !ruby/object:Gem::Dependency
|
46
|
+
version_requirements: *70303456836880
|
47
|
+
- !ruby/object:Gem::Dependency
|
50
48
|
name: activerecord
|
51
|
-
requirement: &
|
49
|
+
requirement: &70303456836440 !ruby/object:Gem::Requirement
|
52
50
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version:
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
57
55
|
type: :runtime
|
58
56
|
prerelease: false
|
59
|
-
version_requirements: *
|
60
|
-
- !ruby/object:Gem::Dependency
|
57
|
+
version_requirements: *70303456836440
|
58
|
+
- !ruby/object:Gem::Dependency
|
61
59
|
name: rake
|
62
|
-
requirement: &
|
60
|
+
requirement: &70303456836020 !ruby/object:Gem::Requirement
|
63
61
|
none: false
|
64
|
-
requirements:
|
65
|
-
- -
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version:
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
68
66
|
type: :runtime
|
69
67
|
prerelease: false
|
70
|
-
version_requirements: *
|
68
|
+
version_requirements: *70303456836020
|
71
69
|
description:
|
72
|
-
email:
|
70
|
+
email:
|
73
71
|
- emmanicolau@gmail.com
|
74
72
|
executables: []
|
75
|
-
|
76
73
|
extensions: []
|
77
|
-
|
78
74
|
extra_rdoc_files: []
|
79
|
-
|
80
|
-
files:
|
75
|
+
files:
|
81
76
|
- .autotest
|
82
77
|
- .gitignore
|
83
78
|
- .rspec
|
@@ -104,41 +99,37 @@ files:
|
|
104
99
|
- spec/ar_enums/factory_spec.rb
|
105
100
|
- spec/schema.rb
|
106
101
|
- spec/spec_helper.rb
|
107
|
-
has_rdoc: true
|
108
102
|
homepage:
|
109
103
|
licenses: []
|
110
|
-
|
111
104
|
post_install_message:
|
112
105
|
rdoc_options: []
|
113
|
-
|
114
|
-
require_paths:
|
106
|
+
require_paths:
|
115
107
|
- lib
|
116
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
109
|
none: false
|
118
|
-
requirements:
|
119
|
-
- -
|
120
|
-
- !ruby/object:Gem::Version
|
121
|
-
|
122
|
-
segments:
|
110
|
+
requirements:
|
111
|
+
- - ! '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
segments:
|
123
115
|
- 0
|
124
|
-
|
125
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
hash: 287372345258701892
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
118
|
none: false
|
127
|
-
requirements:
|
128
|
-
- -
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
|
131
|
-
segments:
|
119
|
+
requirements:
|
120
|
+
- - ! '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
segments:
|
132
124
|
- 0
|
133
|
-
|
125
|
+
hash: 287372345258701892
|
134
126
|
requirements: []
|
135
|
-
|
136
127
|
rubyforge_project: ar-enums
|
137
|
-
rubygems_version: 1.
|
128
|
+
rubygems_version: 1.8.10
|
138
129
|
signing_key:
|
139
130
|
specification_version: 3
|
140
131
|
summary: Provides a simple way for defining enumerations in ActiveRecord models
|
141
|
-
test_files:
|
132
|
+
test_files:
|
142
133
|
- spec/ar_enums/enum_definition_spec.rb
|
143
134
|
- spec/ar_enums/enum_spec.rb
|
144
135
|
- spec/ar_enums/factory_spec.rb
|