enumerate_it 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/Gemfile.lock +11 -11
- data/README.md +5 -5
- data/gemfiles/rails_5.0.gemfile +2 -2
- data/lib/enumerate_it.rb +1 -0
- data/lib/enumerate_it/version.rb +1 -1
- data/spec/enumerate_it/base_spec.rb +4 -4
- metadata +3 -5
- data/.ruby-version +0 -1
- data/enumerate_it.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4943e572df6193e5f41c491ad6a9e67706a2d479
|
4
|
+
data.tar.gz: e4c9c820a8d60911359b158b82cc65fcd647ed8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41fa7c96c3413fa108099c981003b3b3b3a543a0299c03189d64dbb8bff2ed209b2f268868c2836f9532c662236ebf98095513c73f6f20fc73938dbfc6d7b45d
|
7
|
+
data.tar.gz: 1f8c1f5fe4ff3b75f56081b061d50f6ae6f7a789290e5e20092407affd0f184f3ccd0bdbcadfe153917bf8a7d8e9aab26bd12216057e1c76c33fc100e92e5127
|
data/.travis.yml
CHANGED
@@ -5,7 +5,7 @@ sudo: false
|
|
5
5
|
cache: bundler
|
6
6
|
|
7
7
|
script:
|
8
|
-
- "ruby -e \"RUBY_VERSION == '2.3.
|
8
|
+
- "ruby -e \"RUBY_VERSION == '2.3.3' ? system('bundle exec rubocop') : exit(0)\""
|
9
9
|
- bundle exec rake spec
|
10
10
|
|
11
11
|
rvm:
|
@@ -13,7 +13,7 @@ rvm:
|
|
13
13
|
- 2.0.0
|
14
14
|
- 2.1.10
|
15
15
|
- 2.2.5
|
16
|
-
- 2.3.
|
16
|
+
- 2.3.3
|
17
17
|
|
18
18
|
gemfile:
|
19
19
|
- gemfiles/rails_3.0.gemfile
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
enumerate_it (1.4.
|
4
|
+
enumerate_it (1.4.1)
|
5
5
|
activesupport (>= 3.0.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (5.0.
|
10
|
+
activesupport (5.0.1)
|
11
11
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
12
|
i18n (~> 0.7)
|
13
13
|
minitest (~> 5.1)
|
@@ -18,12 +18,12 @@ GEM
|
|
18
18
|
thor (>= 0.14.0)
|
19
19
|
ast (2.3.0)
|
20
20
|
coderay (1.1.1)
|
21
|
-
concurrent-ruby (1.0.
|
21
|
+
concurrent-ruby (1.0.3)
|
22
22
|
diff-lcs (1.2.5)
|
23
23
|
i18n (0.7.0)
|
24
24
|
method_source (0.8.2)
|
25
|
-
minitest (5.
|
26
|
-
parser (2.3.1
|
25
|
+
minitest (5.10.1)
|
26
|
+
parser (2.3.3.1)
|
27
27
|
ast (~> 2.2)
|
28
28
|
powerpack (0.1.1)
|
29
29
|
pry (0.10.4)
|
@@ -31,7 +31,7 @@ GEM
|
|
31
31
|
method_source (~> 0.8.1)
|
32
32
|
slop (~> 3.4)
|
33
33
|
rainbow (2.1.0)
|
34
|
-
rake (
|
34
|
+
rake (12.0.0)
|
35
35
|
rspec (3.5.0)
|
36
36
|
rspec-core (~> 3.5.0)
|
37
37
|
rspec-expectations (~> 3.5.0)
|
@@ -45,21 +45,21 @@ GEM
|
|
45
45
|
diff-lcs (>= 1.2.0, < 2.0)
|
46
46
|
rspec-support (~> 3.5.0)
|
47
47
|
rspec-support (3.5.0)
|
48
|
-
rubocop (0.
|
48
|
+
rubocop (0.46.0)
|
49
49
|
parser (>= 2.3.1.1, < 3.0)
|
50
50
|
powerpack (~> 0.1)
|
51
51
|
rainbow (>= 1.99.1, < 3.0)
|
52
52
|
ruby-progressbar (~> 1.7)
|
53
53
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
54
|
-
rubocop-rspec (1.
|
54
|
+
rubocop-rspec (1.8.0)
|
55
55
|
rubocop (>= 0.42.0)
|
56
56
|
ruby-progressbar (1.8.1)
|
57
57
|
slop (3.6.0)
|
58
|
-
thor (0.19.
|
58
|
+
thor (0.19.4)
|
59
59
|
thread_safe (0.3.5)
|
60
60
|
tzinfo (1.2.2)
|
61
61
|
thread_safe (~> 0.1)
|
62
|
-
unicode-display_width (1.1.
|
62
|
+
unicode-display_width (1.1.2)
|
63
63
|
|
64
64
|
PLATFORMS
|
65
65
|
ruby
|
@@ -75,4 +75,4 @@ DEPENDENCIES
|
|
75
75
|
rubocop-rspec
|
76
76
|
|
77
77
|
BUNDLED WITH
|
78
|
-
1.13.
|
78
|
+
1.13.6
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# EnumerateIt
|
2
2
|
|
3
3
|
Ruby Enumerations with magic powers!
|
4
4
|
|
@@ -14,7 +14,7 @@ Ruby Enumerations with magic powers!
|
|
14
14
|
Firstly, **EnumerateIt** works amazingly well along with **Rails** but it is not required!
|
15
15
|
It means you can add it to any **Ruby** project! 😀
|
16
16
|
|
17
|
-
Secondly, Rails' enumerations
|
17
|
+
Secondly, Rails' enumerations have a problem:
|
18
18
|
[`ActiveRecord::Enum`](http://edgeapi.rubyonrails.org/classes/ActiveRecord/Enum.html) uses
|
19
19
|
`integers` instead of `strings`, which means that if you change your enumeration list oder in your
|
20
20
|
model, your database will no longer be consistent.
|
@@ -254,7 +254,7 @@ This will create:
|
|
254
254
|
p.relationship_status_married?
|
255
255
|
#=> true
|
256
256
|
|
257
|
-
p.
|
257
|
+
p.relationship_status_divorced?
|
258
258
|
#=> false
|
259
259
|
```
|
260
260
|
|
@@ -337,7 +337,7 @@ This will create:
|
|
337
337
|
Person.relationship_status_married.to_sql
|
338
338
|
```
|
339
339
|
|
340
|
-
* An
|
340
|
+
* An inclusion validation (if your class can manage validations and responds to
|
341
341
|
`validates_inclusion_of`):
|
342
342
|
|
343
343
|
```ruby
|
@@ -429,7 +429,7 @@ RelationshipStatus.t(status)
|
|
429
429
|
|
430
430
|
## Using enumerations to handle a legacy database
|
431
431
|
|
432
|
-
**EnumerateIt** can help you
|
432
|
+
**EnumerateIt** can help you build a Rails application around a legacy database which was filled
|
433
433
|
with those small and unchangeable tables used to create foreign key constraints everywhere, like the
|
434
434
|
following example:
|
435
435
|
|
data/gemfiles/rails_5.0.gemfile
CHANGED
data/lib/enumerate_it.rb
CHANGED
data/lib/enumerate_it/version.rb
CHANGED
@@ -30,25 +30,25 @@ describe EnumerateIt::Base do
|
|
30
30
|
context 'by value' do
|
31
31
|
let(:sort_mode) { :value }
|
32
32
|
|
33
|
-
it {
|
33
|
+
it { is_expected.to eq(%w(0 1 2 3)) }
|
34
34
|
end
|
35
35
|
|
36
36
|
context 'by name' do
|
37
37
|
let(:sort_mode) { :name }
|
38
38
|
|
39
|
-
it {
|
39
|
+
it { is_expected.to eq(%w(2 1 3 0)) }
|
40
40
|
end
|
41
41
|
|
42
42
|
context 'by translation' do
|
43
43
|
let(:sort_mode) { :translation }
|
44
44
|
|
45
|
-
it {
|
45
|
+
it { is_expected.to eq(%w(3 2 0 1)) }
|
46
46
|
end
|
47
47
|
|
48
48
|
context 'by nothing' do
|
49
49
|
let(:sort_mode) { :none }
|
50
50
|
|
51
|
-
it {
|
51
|
+
it { is_expected.to eq(%w(1 2 3 0)) }
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enumerate_it
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cássio Marques
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-12-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -132,7 +132,6 @@ files:
|
|
132
132
|
- ".gitignore"
|
133
133
|
- ".rspec"
|
134
134
|
- ".rubocop.yml"
|
135
|
-
- ".ruby-version"
|
136
135
|
- ".travis.yml"
|
137
136
|
- Appraisals
|
138
137
|
- CHANGELOG.md
|
@@ -142,7 +141,6 @@ files:
|
|
142
141
|
- README.md
|
143
142
|
- Rakefile
|
144
143
|
- enumerate_it.gemspec
|
145
|
-
- enumerate_it.png
|
146
144
|
- gemfiles/rails_3.0.gemfile
|
147
145
|
- gemfiles/rails_3.1.gemfile
|
148
146
|
- gemfiles/rails_3.2.gemfile
|
@@ -186,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
184
|
version: '0'
|
187
185
|
requirements: []
|
188
186
|
rubyforge_project:
|
189
|
-
rubygems_version: 2.5.
|
187
|
+
rubygems_version: 2.5.2
|
190
188
|
signing_key:
|
191
189
|
specification_version: 4
|
192
190
|
summary: Ruby Enumerations
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ruby-2.3.1
|
data/enumerate_it.png
DELETED
Binary file
|