magic_enum 0.0.3 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -3
- data/.travis.yml +31 -0
- data/Gemfile +8 -0
- data/lib/magic_enum/class_methods.rb +42 -12
- data/lib/magic_enum/version.rb +2 -2
- data/lib/magic_enum.rb +1 -0
- data/magic_enum.gemspec +3 -1
- data/spec/magic_enum_spec.rb +113 -57
- metadata +98 -74
- data/init.rb +0 -2
data/.gitignore
CHANGED
data/.travis.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
rvm:
|
2
|
+
- ree
|
3
|
+
- 1.8.7
|
4
|
+
- 1.9.3
|
5
|
+
- 2.0.0
|
6
|
+
|
7
|
+
env:
|
8
|
+
- "RAILS_VERSION=2.2.0"
|
9
|
+
- "RAILS_VERSION=2.3.0"
|
10
|
+
- "RAILS_VERSION=3.1.0"
|
11
|
+
- "RAILS_VERSION=3.2.0"
|
12
|
+
- "RAILS_VERSION=4.0.0"
|
13
|
+
|
14
|
+
matrix:
|
15
|
+
exclude:
|
16
|
+
- rvm: ree
|
17
|
+
env: "RAILS_VERSION=4.0.0"
|
18
|
+
- rvm: 1.8.7
|
19
|
+
env: "RAILS_VERSION=4.0.0"
|
20
|
+
- rvm: 1.9.3
|
21
|
+
env: "RAILS_VERSION=2.2.0"
|
22
|
+
- rvm: 1.9.3
|
23
|
+
env: "RAILS_VERSION=2.3.0"
|
24
|
+
- rvm: 2.0.0
|
25
|
+
env: "RAILS_VERSION=2.2.0"
|
26
|
+
- rvm: 2.0.0
|
27
|
+
env: "RAILS_VERSION=2.3.0"
|
28
|
+
|
29
|
+
notifications:
|
30
|
+
recipients:
|
31
|
+
- kpumuk@kpumuk.info
|
data/Gemfile
ADDED
@@ -98,7 +98,7 @@ module MagicEnum
|
|
98
98
|
else
|
99
99
|
a <=> b
|
100
100
|
end
|
101
|
-
end.first unless opts
|
101
|
+
end.first unless opts.key?(:default)
|
102
102
|
|
103
103
|
const_set(enum_inverted, const_get(enum).invert)
|
104
104
|
|
@@ -112,10 +112,11 @@ module MagicEnum
|
|
112
112
|
|
113
113
|
define_method "#{name}=" do |value|
|
114
114
|
value = value.to_sym if value.is_a?(String)
|
115
|
-
raise ArgumentError, "Invalid value \"#{value}\" for :#{name} attribute of the #{self.class} model" if opts[:raise_on_invalid] and self.class.const_get(enum)[value].nil?
|
116
115
|
if value.is_a?(Integer)
|
116
|
+
raise ArgumentError, "Invalid value \"#{value}\" for :#{name} attribute of the #{self.class} model" if opts[:raise_on_invalid] and !self.class.const_get(enum_inverted).key?(value)
|
117
117
|
self[name] = value
|
118
118
|
else
|
119
|
+
raise ArgumentError, "Invalid value \"#{value}\" for :#{name} attribute of the #{self.class} model" if opts[:raise_on_invalid] and !self.class.const_get(enum).key?(value)
|
119
120
|
self[name] = self.class.const_get(enum)[value] || opts[:default]
|
120
121
|
end
|
121
122
|
end
|
@@ -130,20 +131,49 @@ module MagicEnum
|
|
130
131
|
|
131
132
|
# Create named scopes for each enum value
|
132
133
|
if opts[:named_scopes]
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
134
|
+
scope_definition_method = respond_to?(:named_scope) ? :named_scope : :scope
|
135
|
+
|
136
|
+
const_get(enum).each do |key, value|
|
137
|
+
define_enum_scope(enum, key.to_s.pluralize, name, key, opts[:scope_extensions])
|
138
|
+
end
|
139
|
+
|
140
|
+
define_enum_scope(enum, "of_#{name}", name, nil, opts[:scope_extensions])
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
private
|
146
|
+
|
147
|
+
def define_enum_scope(enum, scope_name, name, key, scope_extensions)
|
148
|
+
if respond_to?(:named_scope)
|
149
|
+
# Rails 2.2 - 2.3
|
150
|
+
|
151
|
+
where_clause = if key
|
152
|
+
{ :conditions => { name => const_get(enum)[key] } }
|
153
|
+
else
|
154
|
+
lambda { |t| { :conditions => { name => const_get(enum)[t] } } }
|
139
155
|
end
|
140
|
-
|
141
|
-
|
156
|
+
|
157
|
+
named_scope scope_name.to_sym, where_clause do
|
158
|
+
scope_extensions.each do |ext_name, ext_block|
|
142
159
|
define_method ext_name, ext_block
|
143
|
-
end if
|
160
|
+
end if Hash === scope_extensions
|
161
|
+
end
|
162
|
+
else
|
163
|
+
# Rails 3+
|
164
|
+
|
165
|
+
where_clause = if key
|
166
|
+
lambda { where(name => const_get(enum)[key]) }
|
167
|
+
else
|
168
|
+
lambda { |t| where(name => const_get(enum)[t]) }
|
144
169
|
end
|
145
|
-
end
|
146
170
|
|
171
|
+
scope scope_name.to_sym, where_clause do
|
172
|
+
scope_extensions.each do |ext_name, ext_block|
|
173
|
+
define_method ext_name, ext_block
|
174
|
+
end if Hash === scope_extensions
|
175
|
+
end
|
176
|
+
end
|
147
177
|
end
|
148
178
|
end
|
149
179
|
end
|
data/lib/magic_enum/version.rb
CHANGED
data/lib/magic_enum.rb
CHANGED
data/magic_enum.gemspec
CHANGED
@@ -20,7 +20,9 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.extra_rdoc_files = [ 'LICENSE', 'README.rdoc' ]
|
21
21
|
|
22
22
|
# Dependencies
|
23
|
-
s.add_dependency 'activerecord'
|
23
|
+
s.add_dependency 'activerecord'
|
24
24
|
s.add_development_dependency 'rspec'
|
25
|
+
s.add_development_dependency 'rake'
|
26
|
+
s.add_development_dependency 'rdoc'
|
25
27
|
s.add_development_dependency 'yard'
|
26
28
|
end
|
data/spec/magic_enum_spec.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
|
4
|
-
require File.dirname(__FILE__) + '/../init'
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'magic_enum'
|
5
3
|
|
6
4
|
module MagicEnumHelper
|
7
5
|
class TestModelBase
|
8
|
-
|
6
|
+
extend MagicEnum::ClassMethods
|
9
7
|
Statuses = { :unknown => 0, :draft => 1, :published => 2 }
|
10
8
|
|
11
9
|
def [](attr_name)
|
@@ -21,20 +19,20 @@ end
|
|
21
19
|
describe 'Model with magic enum' do
|
22
20
|
include MagicEnumHelper
|
23
21
|
|
24
|
-
class
|
22
|
+
class TestModelSimple < MagicEnumHelper::TestModelBase
|
25
23
|
define_enum :status
|
26
24
|
end
|
27
25
|
|
28
26
|
before do
|
29
|
-
@model =
|
27
|
+
@model = TestModelSimple.new
|
30
28
|
end
|
31
29
|
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
it 'should define methods to get and set enum field' do
|
31
|
+
TestModelSimple.should be_method_defined(:status)
|
32
|
+
TestModelSimple.should be_method_defined(:status=)
|
35
33
|
end
|
36
34
|
|
37
|
-
|
35
|
+
it 'should store enum value using [] operation on model' do
|
38
36
|
@model.status = :draft
|
39
37
|
@model[:status].should == 1
|
40
38
|
@model.status.should == :draft
|
@@ -43,7 +41,7 @@ describe 'Model with magic enum' do
|
|
43
41
|
@model.status.should == :unknown
|
44
42
|
end
|
45
43
|
|
46
|
-
|
44
|
+
it 'should store enum value if key is given as string' do
|
47
45
|
@model.status = 'draft'
|
48
46
|
@model[:status].should == 1
|
49
47
|
@model.status.should == :draft
|
@@ -52,7 +50,7 @@ describe 'Model with magic enum' do
|
|
52
50
|
@model.status.should == :unknown
|
53
51
|
end
|
54
52
|
|
55
|
-
|
53
|
+
it 'should store enum value if key is given as integer equivalent' do
|
56
54
|
@model.status = 1
|
57
55
|
@model[:status].should == 1
|
58
56
|
@model.status.should == :draft
|
@@ -61,17 +59,17 @@ describe 'Model with magic enum' do
|
|
61
59
|
@model.status.should == :unknown
|
62
60
|
end
|
63
61
|
|
64
|
-
|
65
|
-
@model.
|
66
|
-
@model.
|
67
|
-
@model.
|
62
|
+
it 'should not define simple accessors by default' do
|
63
|
+
@model.should_not respond_to(:unknown?)
|
64
|
+
@model.should_not respond_to(:draft?)
|
65
|
+
@model.should_not respond_to(:published?)
|
68
66
|
end
|
69
67
|
|
70
|
-
|
71
|
-
lambda { @model.status = :invalid }.should_not raise_error
|
68
|
+
it 'should not raise error when invalid value received' do
|
69
|
+
lambda { @model.status = :invalid }.should_not raise_error
|
72
70
|
end
|
73
71
|
|
74
|
-
|
72
|
+
it 'should use default value 0 when invalid value received or current state invalid' do
|
75
73
|
@model[:status] = -1
|
76
74
|
@model.status.should == :unknown
|
77
75
|
@model.status = :published
|
@@ -81,14 +79,15 @@ describe 'Model with magic enum' do
|
|
81
79
|
@model.status.should == :unknown
|
82
80
|
end
|
83
81
|
|
84
|
-
|
82
|
+
it 'should return string value when _name method called' do
|
85
83
|
@model.status_name.should == 'unknown'
|
86
84
|
@model.status = :published
|
87
85
|
@model.status_name.should == 'published'
|
88
86
|
end
|
89
87
|
|
90
|
-
|
91
|
-
|
88
|
+
it 'should not define named scopes by default' do
|
89
|
+
TestModelSimple.should_not_receive(:named_scope)
|
90
|
+
TestModelSimple.should_not_receive(:scope)
|
92
91
|
end
|
93
92
|
|
94
93
|
end
|
@@ -96,20 +95,20 @@ end
|
|
96
95
|
describe 'Model with magic enum and default value specified' do
|
97
96
|
include MagicEnumHelper
|
98
97
|
|
99
|
-
class
|
98
|
+
class TestModelWithDefault < MagicEnumHelper::TestModelBase
|
100
99
|
define_enum :status, :default => 2
|
101
100
|
end
|
102
101
|
|
103
102
|
before do
|
104
|
-
@model =
|
103
|
+
@model = TestModelWithDefault.new
|
105
104
|
end
|
106
105
|
|
107
|
-
|
106
|
+
it 'should use default value when current state is invalid' do
|
108
107
|
@model[:status] = -1
|
109
108
|
@model.status.should == :published
|
110
109
|
end
|
111
110
|
|
112
|
-
|
111
|
+
it 'should use default value when invalid value received' do
|
113
112
|
@model.status = nil
|
114
113
|
@model.status.should == :published
|
115
114
|
@model.status = :invalid
|
@@ -117,7 +116,7 @@ describe 'Model with magic enum and default value specified' do
|
|
117
116
|
@model[:status].should == 2
|
118
117
|
end
|
119
118
|
|
120
|
-
|
119
|
+
it 'should not interpret nil in the same way as 0' do
|
121
120
|
@model[:status].should be_nil
|
122
121
|
@model.status.should == :published
|
123
122
|
@model[:status] = 0
|
@@ -125,26 +124,83 @@ describe 'Model with magic enum and default value specified' do
|
|
125
124
|
end
|
126
125
|
end
|
127
126
|
|
127
|
+
describe 'Model with magic enum and default value specified as nil' do
|
128
|
+
include MagicEnumHelper
|
129
|
+
|
130
|
+
class TestModelWithDefaultNil < MagicEnumHelper::TestModelBase
|
131
|
+
SimpleStatuses = { :unknown => 0, :draft => 1, :published => 2, :simple => nil }
|
132
|
+
define_enum :simple_status, :default => nil
|
133
|
+
end
|
134
|
+
|
135
|
+
before do
|
136
|
+
@model = TestModelWithDefaultNil.new
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'should use default value when current state is invalid' do
|
140
|
+
@model[:simple_status] = -1
|
141
|
+
@model.simple_status.should == :simple
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'should use default value when invalid value received' do
|
145
|
+
@model.simple_status = nil
|
146
|
+
@model.simple_status.should == :simple
|
147
|
+
@model.simple_status = :invalid
|
148
|
+
@model.simple_status.should == :simple
|
149
|
+
@model[:simple_status].should be_nil
|
150
|
+
end
|
151
|
+
|
152
|
+
it 'should not interpret nil in the same way as 0' do
|
153
|
+
@model[:simple_status].should be_nil
|
154
|
+
@model.simple_status.should == :simple
|
155
|
+
@model[:simple_status] = 0
|
156
|
+
@model.simple_status.should == :unknown
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
128
160
|
describe 'Model with magic enum and raise_on_invalid option specified' do
|
129
161
|
include MagicEnumHelper
|
130
162
|
|
131
|
-
class
|
163
|
+
class TestModelWithRaiseOnInvalid < MagicEnumHelper::TestModelBase
|
132
164
|
define_enum :status, :raise_on_invalid => true
|
133
165
|
end
|
134
166
|
|
135
167
|
before do
|
136
|
-
@model =
|
168
|
+
@model = TestModelWithRaiseOnInvalid.new
|
137
169
|
end
|
138
170
|
|
139
|
-
|
140
|
-
|
171
|
+
context 'with symbol value' do
|
172
|
+
it 'should not raise error when valid value received' do
|
173
|
+
lambda { @model.status = :draft }.should_not raise_error
|
174
|
+
end
|
175
|
+
|
176
|
+
it 'should raise error when invalid value received' do
|
177
|
+
lambda { @model.status = :invalid }.should raise_error(ArgumentError)
|
178
|
+
end
|
179
|
+
|
180
|
+
it 'should show error description when invalid value received' do
|
181
|
+
begin
|
182
|
+
@model.status = :invalid
|
183
|
+
rescue => e
|
184
|
+
e.message.should == 'Invalid value "invalid" for :status attribute of the TestModelWithRaiseOnInvalid model'
|
185
|
+
end
|
186
|
+
end
|
141
187
|
end
|
142
188
|
|
143
|
-
|
144
|
-
|
145
|
-
@model.status =
|
146
|
-
|
147
|
-
|
189
|
+
context 'with integer value' do
|
190
|
+
it 'should not raise error when valid value received' do
|
191
|
+
lambda { @model.status = 1 }.should_not raise_error
|
192
|
+
end
|
193
|
+
|
194
|
+
it 'should raise error when invalid value received' do
|
195
|
+
lambda { @model.status = 4 }.should raise_error(ArgumentError)
|
196
|
+
end
|
197
|
+
|
198
|
+
it 'should show error description when invalid value received' do
|
199
|
+
begin
|
200
|
+
@model.status = 4
|
201
|
+
rescue => e
|
202
|
+
e.message.should == 'Invalid value "4" for :status attribute of the TestModelWithRaiseOnInvalid model'
|
203
|
+
end
|
148
204
|
end
|
149
205
|
end
|
150
206
|
end
|
@@ -153,41 +209,41 @@ end
|
|
153
209
|
describe 'Model with magic enum and simple_accessors option specified' do
|
154
210
|
include MagicEnumHelper
|
155
211
|
|
156
|
-
class
|
212
|
+
class TestModelWithSimpleAccessors < MagicEnumHelper::TestModelBase
|
157
213
|
define_enum :status, :simple_accessors => true
|
158
214
|
end
|
159
215
|
|
160
216
|
before do
|
161
|
-
@model =
|
217
|
+
@model = TestModelWithSimpleAccessors.new
|
162
218
|
end
|
163
219
|
|
164
|
-
|
165
|
-
@model.
|
166
|
-
@model.
|
167
|
-
@model.
|
220
|
+
it 'should define simple accessors by default' do
|
221
|
+
@model.should respond_to(:unknown?)
|
222
|
+
@model.should respond_to(:draft?)
|
223
|
+
@model.should respond_to(:published?)
|
168
224
|
end
|
169
225
|
end
|
170
226
|
|
171
227
|
describe 'Model with magic enum and named_scopes option specified' do
|
172
228
|
include MagicEnumHelper
|
173
229
|
|
174
|
-
class
|
230
|
+
class TestModelWithNamedScopes < ActiveRecord::Base
|
231
|
+
Statuses = { :unknown => 0, :draft => 1, :published => 2 }
|
232
|
+
define_enum :status, :named_scopes => true
|
175
233
|
end
|
176
234
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
# since we can't set an expectation with a Proc argument
|
183
|
-
TestModel5.send(:define_enum, :status, :named_scopes => true)
|
235
|
+
it 'should define named_scopes' do
|
236
|
+
TestModelWithNamedScopes.should respond_to(:unknowns)
|
237
|
+
TestModelWithNamedScopes.should respond_to(:drafts)
|
238
|
+
TestModelWithNamedScopes.should respond_to(:publisheds)
|
239
|
+
TestModelWithNamedScopes.should respond_to(:of_status)
|
184
240
|
end
|
185
241
|
end
|
186
242
|
|
187
243
|
describe 'Model with magic enum and enum option specified' do
|
188
244
|
include MagicEnumHelper
|
189
245
|
|
190
|
-
class
|
246
|
+
class TestModelEnumOption < MagicEnumHelper::TestModelBase
|
191
247
|
Roles = {
|
192
248
|
:user => 'u',
|
193
249
|
:admin => 'a'
|
@@ -196,10 +252,10 @@ describe 'Model with magic enum and enum option specified' do
|
|
196
252
|
end
|
197
253
|
|
198
254
|
before do
|
199
|
-
@model =
|
255
|
+
@model = TestModelEnumOption.new
|
200
256
|
end
|
201
257
|
|
202
|
-
|
258
|
+
it 'should use custom enum' do
|
203
259
|
@model.status = :user
|
204
260
|
@model.status.should == :user
|
205
261
|
@model[:status].should == 'u'
|
@@ -208,14 +264,14 @@ describe 'Model with magic enum and enum option specified' do
|
|
208
264
|
@model[:status].should == 'a'
|
209
265
|
end
|
210
266
|
|
211
|
-
|
267
|
+
it 'should use option with min value as default' do
|
212
268
|
@model.status = :invalid
|
213
269
|
@model.status.should == :admin
|
214
270
|
end
|
215
271
|
end
|
216
272
|
|
217
273
|
describe 'ActiveRecord::Base class' do
|
218
|
-
|
219
|
-
ActiveRecord::Base.
|
274
|
+
it 'should include MagicEnum methods' do
|
275
|
+
ActiveRecord::Base.should respond_to(:define_enum)
|
220
276
|
end
|
221
277
|
end
|
metadata
CHANGED
@@ -1,81 +1,112 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: magic_enum
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 3
|
10
|
-
version: 0.0.3
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Dmytro Shteflyuk
|
14
9
|
- Oleksiy Kovyrin
|
15
10
|
autorequire:
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2013-08-08 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
22
16
|
name: activerecord
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 3
|
32
|
-
- 3
|
33
|
-
version: "3.3"
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
34
23
|
type: :runtime
|
35
|
-
|
36
|
-
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
31
|
+
- !ruby/object:Gem::Dependency
|
37
32
|
name: rspec
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
type: :development
|
38
40
|
prerelease: false
|
39
|
-
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
40
50
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
version: "0"
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
48
55
|
type: :development
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: yard
|
52
56
|
prerelease: false
|
53
|
-
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: rdoc
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
54
66
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
segments:
|
60
|
-
- 0
|
61
|
-
version: "0"
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
62
71
|
type: :development
|
63
|
-
|
64
|
-
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: yard
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
type: :development
|
88
|
+
prerelease: false
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
description: MagicEnum is a simple ActiveRecord plugin that makes it easier to maintain
|
96
|
+
ENUM-like attributes in your models.
|
65
97
|
email: alexey@kovyrin.net
|
66
98
|
executables: []
|
67
|
-
|
68
99
|
extensions: []
|
69
|
-
|
70
|
-
extra_rdoc_files:
|
100
|
+
extra_rdoc_files:
|
71
101
|
- LICENSE
|
72
102
|
- README.rdoc
|
73
|
-
files:
|
103
|
+
files:
|
74
104
|
- .gitignore
|
105
|
+
- .travis.yml
|
106
|
+
- Gemfile
|
75
107
|
- LICENSE
|
76
108
|
- README.rdoc
|
77
109
|
- Rakefile
|
78
|
-
- init.rb
|
79
110
|
- lib/magic_enum.rb
|
80
111
|
- lib/magic_enum/class_methods.rb
|
81
112
|
- lib/magic_enum/version.rb
|
@@ -83,36 +114,29 @@ files:
|
|
83
114
|
- spec/magic_enum_spec.rb
|
84
115
|
homepage: https://github.com/kovyrin/magic-enum
|
85
116
|
licenses: []
|
86
|
-
|
87
117
|
post_install_message:
|
88
|
-
rdoc_options:
|
118
|
+
rdoc_options:
|
89
119
|
- --charset=UTF-8
|
90
|
-
require_paths:
|
120
|
+
require_paths:
|
91
121
|
- lib
|
92
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
123
|
none: false
|
94
|
-
requirements:
|
95
|
-
- -
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
|
98
|
-
|
99
|
-
- 0
|
100
|
-
version: "0"
|
101
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ! '>='
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
129
|
none: false
|
103
|
-
requirements:
|
104
|
-
- -
|
105
|
-
- !ruby/object:Gem::Version
|
106
|
-
|
107
|
-
segments:
|
108
|
-
- 0
|
109
|
-
version: "0"
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
110
134
|
requirements: []
|
111
|
-
|
112
135
|
rubyforge_project:
|
113
|
-
rubygems_version: 1.8.
|
136
|
+
rubygems_version: 1.8.24
|
114
137
|
signing_key:
|
115
138
|
specification_version: 3
|
116
|
-
summary: ActiveRecord plugin that makes it easier to maintain ENUM-like attributes
|
139
|
+
summary: ActiveRecord plugin that makes it easier to maintain ENUM-like attributes
|
140
|
+
in your models
|
117
141
|
test_files: []
|
118
|
-
|
142
|
+
has_rdoc:
|
data/init.rb
DELETED