enumerate_it 1.6.1 → 1.7.0
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 +5 -5
- data/.gitignore +1 -0
- data/.rubocop.yml +10 -4
- data/.travis.yml +20 -7
- data/Appraisals +4 -1
- data/Gemfile.lock +34 -36
- data/LICENSE +5 -1
- data/README.md +6 -5
- data/enumerate_it.gemspec +2 -1
- data/gemfiles/rails_3.0.gemfile +4 -4
- data/gemfiles/rails_3.1.gemfile +4 -4
- data/gemfiles/rails_3.2.gemfile +4 -4
- data/gemfiles/rails_4.0.gemfile +4 -4
- data/gemfiles/rails_4.1.gemfile +4 -4
- data/gemfiles/rails_4.2.gemfile +4 -4
- data/gemfiles/rails_5.0.gemfile +4 -4
- data/gemfiles/rails_5.1.gemfile +4 -4
- data/lib/enumerate_it/base.rb +1 -1
- data/lib/enumerate_it/class_methods.rb +2 -2
- data/lib/enumerate_it/version.rb +1 -1
- data/lib/generators/enumerate_it/enum/enum_generator.rb +1 -1
- data/spec/enumerate_it/base_spec.rb +5 -1
- data/spec/enumerate_it_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- data/spec/support/test_classes.rb +4 -0
- metadata +5 -5
- data/gemfiles/.bundle/config +0 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 1d4ae76c51d155d1805ae3f30687471dcde4354e7e28a0b5b4a67c1fec61833a
|
|
4
|
+
data.tar.gz: b2ffcc7e088b1a77b8c8002c923ae8e6283557d179eb03e1ebe4cc183e6d9293
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3f78959342d203d10c9a21d00472292d08c291da985e1b37c8bf5fa91fb8d5b960d5c2bcea660e61bbae57ee1638070abcb63e1359311f07168caa753256a637
|
|
7
|
+
data.tar.gz: b78fbe58f60eba4819056e81d49d7a31dc286051a6255e4b1a9bad9939be55aa13e98db2c19a8e59df93490e269ce86dbf6a5a9384aa0b1d13a8d680acd43681
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -11,6 +11,9 @@ AllCops:
|
|
|
11
11
|
- 'lib/generators/enumerate_it/enum/templates/**/*'
|
|
12
12
|
- 'gemfiles/vendor/**/*'
|
|
13
13
|
|
|
14
|
+
Gemspec/RequiredRubyVersion:
|
|
15
|
+
Enabled: false
|
|
16
|
+
|
|
14
17
|
Lint/EndAlignment:
|
|
15
18
|
Enabled: false
|
|
16
19
|
|
|
@@ -39,13 +42,13 @@ Style/FrozenStringLiteralComment:
|
|
|
39
42
|
Style/Documentation:
|
|
40
43
|
Enabled: false
|
|
41
44
|
|
|
42
|
-
Style/PredicateName:
|
|
43
|
-
Exclude:
|
|
44
|
-
- 'lib/enumerate_it/class_methods.rb'
|
|
45
|
-
|
|
46
45
|
Style/GuardClause:
|
|
47
46
|
MinBodyLength: 3
|
|
48
47
|
|
|
48
|
+
Naming/PredicateName:
|
|
49
|
+
Exclude:
|
|
50
|
+
- 'lib/enumerate_it/class_methods.rb'
|
|
51
|
+
|
|
49
52
|
RSpec/MultipleExpectations:
|
|
50
53
|
Enabled: false
|
|
51
54
|
|
|
@@ -57,3 +60,6 @@ RSpec/MessageExpectation:
|
|
|
57
60
|
|
|
58
61
|
RSpec/MessageSpies:
|
|
59
62
|
Enabled: false
|
|
63
|
+
|
|
64
|
+
RSpec/ContextWording:
|
|
65
|
+
Enabled: false
|
data/.travis.yml
CHANGED
|
@@ -4,16 +4,20 @@ sudo: false
|
|
|
4
4
|
|
|
5
5
|
cache: bundler
|
|
6
6
|
|
|
7
|
+
before_install:
|
|
8
|
+
- gem update --system
|
|
9
|
+
|
|
7
10
|
script:
|
|
8
|
-
- "ruby -e \"RUBY_VERSION == '2.
|
|
9
|
-
- bundle exec rake spec
|
|
11
|
+
- "ruby -e \"RUBY_VERSION == '2.5.0' ? system('bundle exec rubocop') : exit(0)\""
|
|
12
|
+
- bundle exec rake spec
|
|
10
13
|
|
|
11
14
|
rvm:
|
|
12
15
|
- 2.0.0
|
|
13
16
|
- 2.1.10
|
|
14
|
-
- 2.2.
|
|
15
|
-
- 2.3.
|
|
16
|
-
- 2.4.
|
|
17
|
+
- 2.2.9
|
|
18
|
+
- 2.3.6
|
|
19
|
+
- 2.4.3
|
|
20
|
+
- 2.5.0
|
|
17
21
|
|
|
18
22
|
gemfile:
|
|
19
23
|
- gemfiles/rails_3.0.gemfile
|
|
@@ -39,11 +43,20 @@ matrix:
|
|
|
39
43
|
|
|
40
44
|
# Rails 4.0 and 4.1 requires an old version of `json` gem, which isn't compatible with Ruby 2.4+
|
|
41
45
|
# https://github.com/flori/json/issues/308
|
|
42
|
-
- rvm: 2.4.
|
|
46
|
+
- rvm: 2.4.3
|
|
47
|
+
gemfile: gemfiles/rails_4.0.gemfile
|
|
48
|
+
- rvm: 2.4.3
|
|
49
|
+
gemfile: gemfiles/rails_4.1.gemfile
|
|
50
|
+
- rvm: 2.5.0
|
|
43
51
|
gemfile: gemfiles/rails_4.0.gemfile
|
|
44
|
-
- rvm: 2.
|
|
52
|
+
- rvm: 2.5.0
|
|
45
53
|
gemfile: gemfiles/rails_4.1.gemfile
|
|
46
54
|
|
|
55
|
+
# Rails 3.0 doesn't work with Ruby 2.5
|
|
56
|
+
# (`undefined method `yaml_as' for BigDecimal:Class`)
|
|
57
|
+
- rvm: 2.5.0
|
|
58
|
+
gemfile: gemfiles/rails_3.0.gemfile
|
|
59
|
+
|
|
47
60
|
addons:
|
|
48
61
|
code_climate:
|
|
49
62
|
repo_token: 60e4a18e2a4bc86a98f92847f16756876c13d1e772058a9b3296643b04a697d7
|
data/Appraisals
CHANGED
|
@@ -6,7 +6,10 @@ rails_versions = JSON.parse(Net::HTTP.get(URI('https://rubygems.org/api/v1/versi
|
|
|
6
6
|
|
|
7
7
|
%w[3.0 3.1 3.2 4.0 4.1 4.2 5.0 5.1].each do |version|
|
|
8
8
|
appraise "rails_#{version}" do
|
|
9
|
-
current_version = rails_versions
|
|
9
|
+
current_version = rails_versions
|
|
10
|
+
.select { |key| key.match(/\A#{version}/) }
|
|
11
|
+
.sort { |a, b| Gem::Version.new(a) <=> Gem::Version.new(b) }
|
|
12
|
+
.last
|
|
10
13
|
|
|
11
14
|
gem 'activesupport', "~> #{current_version}"
|
|
12
15
|
gem 'activerecord', "~> #{current_version}"
|
data/Gemfile.lock
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
enumerate_it (1.
|
|
4
|
+
enumerate_it (1.7.0)
|
|
5
5
|
activesupport (>= 3.0.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
activesupport (5.1.
|
|
10
|
+
activesupport (5.1.5)
|
|
11
11
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
12
12
|
i18n (~> 0.7)
|
|
13
13
|
minitest (~> 5.1)
|
|
@@ -16,51 +16,49 @@ GEM
|
|
|
16
16
|
bundler
|
|
17
17
|
rake
|
|
18
18
|
thor (>= 0.14.0)
|
|
19
|
-
ast (2.
|
|
20
|
-
coderay (1.1.
|
|
19
|
+
ast (2.4.0)
|
|
20
|
+
coderay (1.1.2)
|
|
21
21
|
concurrent-ruby (1.0.5)
|
|
22
22
|
diff-lcs (1.3)
|
|
23
|
-
i18n (0.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
i18n (0.9.5)
|
|
24
|
+
concurrent-ruby (~> 1.0)
|
|
25
|
+
method_source (0.9.0)
|
|
26
|
+
minitest (5.11.3)
|
|
27
|
+
parallel (1.12.1)
|
|
28
|
+
parser (2.5.0.3)
|
|
29
|
+
ast (~> 2.4.0)
|
|
29
30
|
powerpack (0.1.1)
|
|
30
|
-
pry (0.
|
|
31
|
+
pry (0.11.3)
|
|
31
32
|
coderay (~> 1.1.0)
|
|
32
|
-
method_source (~> 0.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
rspec-
|
|
39
|
-
|
|
40
|
-
rspec-
|
|
41
|
-
rspec-
|
|
42
|
-
rspec-support (~> 3.6.0)
|
|
43
|
-
rspec-expectations (3.6.0)
|
|
33
|
+
method_source (~> 0.9.0)
|
|
34
|
+
rainbow (3.0.0)
|
|
35
|
+
rake (12.3.0)
|
|
36
|
+
rspec (3.7.0)
|
|
37
|
+
rspec-core (~> 3.7.0)
|
|
38
|
+
rspec-expectations (~> 3.7.0)
|
|
39
|
+
rspec-mocks (~> 3.7.0)
|
|
40
|
+
rspec-core (3.7.1)
|
|
41
|
+
rspec-support (~> 3.7.0)
|
|
42
|
+
rspec-expectations (3.7.0)
|
|
44
43
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
45
|
-
rspec-support (~> 3.
|
|
46
|
-
rspec-mocks (3.
|
|
44
|
+
rspec-support (~> 3.7.0)
|
|
45
|
+
rspec-mocks (3.7.0)
|
|
47
46
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
48
|
-
rspec-support (~> 3.
|
|
49
|
-
rspec-support (3.
|
|
50
|
-
rubocop (0.
|
|
47
|
+
rspec-support (~> 3.7.0)
|
|
48
|
+
rspec-support (3.7.1)
|
|
49
|
+
rubocop (0.53.0)
|
|
51
50
|
parallel (~> 1.10)
|
|
52
|
-
parser (>= 2.
|
|
51
|
+
parser (>= 2.5)
|
|
53
52
|
powerpack (~> 0.1)
|
|
54
|
-
rainbow (>=
|
|
53
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
55
54
|
ruby-progressbar (~> 1.7)
|
|
56
55
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
|
57
|
-
rubocop-rspec (1.
|
|
58
|
-
rubocop (>= 0.
|
|
59
|
-
ruby-progressbar (1.
|
|
60
|
-
slop (3.6.0)
|
|
56
|
+
rubocop-rspec (1.24.0)
|
|
57
|
+
rubocop (>= 0.53.0)
|
|
58
|
+
ruby-progressbar (1.9.0)
|
|
61
59
|
thor (0.20.0)
|
|
62
60
|
thread_safe (0.3.6)
|
|
63
|
-
tzinfo (1.2.
|
|
61
|
+
tzinfo (1.2.5)
|
|
64
62
|
thread_safe (~> 0.1)
|
|
65
63
|
unicode-display_width (1.3.0)
|
|
66
64
|
wwtd (1.3.0)
|
|
@@ -80,4 +78,4 @@ DEPENDENCIES
|
|
|
80
78
|
wwtd
|
|
81
79
|
|
|
82
80
|
BUNDLED WITH
|
|
83
|
-
1.
|
|
81
|
+
1.16.1
|
data/LICENSE
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
LICENSE
|
|
2
|
+
|
|
3
|
+
The MIT License
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2010-2018 Cássio Marques and Lucas Caton
|
|
2
6
|
|
|
3
7
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
8
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# EnumerateIt
|
|
2
2
|
|
|
3
|
-
Ruby
|
|
3
|
+
Enumerations for Ruby with some magic powers! 🎩
|
|
4
4
|
|
|
5
5
|
[](https://travis-ci.org/lucascaton/enumerate_it)
|
|
6
6
|
[](https://rubygems.org/gems/enumerate_it)
|
|
7
7
|
[](https://gemnasium.com/github.com/lucascaton/enumerate_it)
|
|
8
8
|
[](https://codeclimate.com/github/lucascaton/enumerate_it)
|
|
9
|
+
[](https://rubygems.org/gems/enumerate_it)
|
|
9
10
|
[](https://github.com/lucascaton/enumerate_it/releases)
|
|
10
11
|
|
|
11
12
|
**EnumerateIt** helps you to declare and use enumerations in a very simple and flexible way.
|
|
@@ -402,8 +403,8 @@ You sure can! 😄
|
|
|
402
403
|
|
|
403
404
|
#### What versions of Ruby and Rails are supported?
|
|
404
405
|
|
|
405
|
-
* **Ruby** `2.0`
|
|
406
|
-
* **Rails** `3.0`
|
|
406
|
+
* **Ruby** from `2.0` to `2.4`
|
|
407
|
+
* **Rails** from `3.0` to `5.1`
|
|
407
408
|
|
|
408
409
|
All versions are tested via
|
|
409
410
|
[Travis](https://github.com/lucascaton/enumerate_it/blob/master/.travis.yml).
|
|
@@ -507,7 +508,7 @@ You can also sort it by its **value** using `sort_by :value`.
|
|
|
507
508
|
|
|
508
509
|
## Changelog
|
|
509
510
|
|
|
510
|
-
Changes are maintained under [Releases](https://github.com/lucascaton/enumerate_it/releases).
|
|
511
|
+
Changes are maintained under [Releases page](https://github.com/lucascaton/enumerate_it/releases).
|
|
511
512
|
|
|
512
513
|
## Note on Patches/Pull Requests
|
|
513
514
|
|
|
@@ -521,4 +522,4 @@ Changes are maintained under [Releases](https://github.com/lucascaton/enumerate_
|
|
|
521
522
|
|
|
522
523
|
## Copyright
|
|
523
524
|
|
|
524
|
-
Copyright (c) 2010-
|
|
525
|
+
Copyright (c) 2010-2018 Cássio Marques and Lucas Caton. See `LICENSE` file for details.
|
data/enumerate_it.gemspec
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
require File.expand_path('
|
|
1
|
+
require File.expand_path('lib/enumerate_it/version', __dir__)
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |gem|
|
|
4
4
|
gem.authors = ['Cássio Marques', 'Lucas Caton']
|
|
5
5
|
gem.summary = 'Ruby Enumerations'
|
|
6
6
|
gem.description = 'Enumerations for Ruby with some magic powers!'
|
|
7
7
|
gem.homepage = 'https://github.com/lucascaton/enumerate_it'
|
|
8
|
+
gem.license = 'MIT'
|
|
8
9
|
|
|
9
10
|
gem.files = `git ls-files`.split("\n")
|
|
10
11
|
gem.test_files = `git ls-files -- spec/*`.split("\n")
|
data/gemfiles/rails_3.0.gemfile
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# This file was generated by Appraisal
|
|
2
2
|
|
|
3
|
-
source
|
|
3
|
+
source 'https://rubygems.org'
|
|
4
4
|
|
|
5
|
-
gem
|
|
6
|
-
gem
|
|
5
|
+
gem 'activerecord', '~> 3.0.20'
|
|
6
|
+
gem 'activesupport', '~> 3.0.20'
|
|
7
7
|
|
|
8
|
-
gemspec path:
|
|
8
|
+
gemspec path: '../'
|
data/gemfiles/rails_3.1.gemfile
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# This file was generated by Appraisal
|
|
2
2
|
|
|
3
|
-
source
|
|
3
|
+
source 'https://rubygems.org'
|
|
4
4
|
|
|
5
|
-
gem
|
|
6
|
-
gem
|
|
5
|
+
gem 'activerecord', '~> 3.1.12'
|
|
6
|
+
gem 'activesupport', '~> 3.1.12'
|
|
7
7
|
|
|
8
|
-
gemspec path:
|
|
8
|
+
gemspec path: '../'
|
data/gemfiles/rails_3.2.gemfile
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# This file was generated by Appraisal
|
|
2
2
|
|
|
3
|
-
source
|
|
3
|
+
source 'https://rubygems.org'
|
|
4
4
|
|
|
5
|
-
gem
|
|
6
|
-
gem
|
|
5
|
+
gem 'activerecord', '~> 3.2.22.5'
|
|
6
|
+
gem 'activesupport', '~> 3.2.22.5'
|
|
7
7
|
|
|
8
|
-
gemspec path:
|
|
8
|
+
gemspec path: '../'
|
data/gemfiles/rails_4.0.gemfile
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# This file was generated by Appraisal
|
|
2
2
|
|
|
3
|
-
source
|
|
3
|
+
source 'https://rubygems.org'
|
|
4
4
|
|
|
5
|
-
gem
|
|
6
|
-
gem
|
|
5
|
+
gem 'activerecord', '~> 4.0.13'
|
|
6
|
+
gem 'activesupport', '~> 4.0.13'
|
|
7
7
|
|
|
8
|
-
gemspec path:
|
|
8
|
+
gemspec path: '../'
|
data/gemfiles/rails_4.1.gemfile
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# This file was generated by Appraisal
|
|
2
2
|
|
|
3
|
-
source
|
|
3
|
+
source 'https://rubygems.org'
|
|
4
4
|
|
|
5
|
-
gem
|
|
6
|
-
gem
|
|
5
|
+
gem 'activerecord', '~> 4.1.16'
|
|
6
|
+
gem 'activesupport', '~> 4.1.16'
|
|
7
7
|
|
|
8
|
-
gemspec path:
|
|
8
|
+
gemspec path: '../'
|
data/gemfiles/rails_4.2.gemfile
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# This file was generated by Appraisal
|
|
2
2
|
|
|
3
|
-
source
|
|
3
|
+
source 'https://rubygems.org'
|
|
4
4
|
|
|
5
|
-
gem
|
|
6
|
-
gem
|
|
5
|
+
gem 'activerecord', '~> 4.2.10'
|
|
6
|
+
gem 'activesupport', '~> 4.2.10'
|
|
7
7
|
|
|
8
|
-
gemspec path:
|
|
8
|
+
gemspec path: '../'
|
data/gemfiles/rails_5.0.gemfile
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# This file was generated by Appraisal
|
|
2
2
|
|
|
3
|
-
source
|
|
3
|
+
source 'https://rubygems.org'
|
|
4
4
|
|
|
5
|
-
gem
|
|
6
|
-
gem
|
|
5
|
+
gem 'activerecord', '~> 5.0.6'
|
|
6
|
+
gem 'activesupport', '~> 5.0.6'
|
|
7
7
|
|
|
8
|
-
gemspec path:
|
|
8
|
+
gemspec path: '../'
|
data/gemfiles/rails_5.1.gemfile
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# This file was generated by Appraisal
|
|
2
2
|
|
|
3
|
-
source
|
|
3
|
+
source 'https://rubygems.org'
|
|
4
4
|
|
|
5
|
-
gem
|
|
6
|
-
gem
|
|
5
|
+
gem 'activerecord', '~> 5.1.5'
|
|
6
|
+
gem 'activesupport', '~> 5.1.5'
|
|
7
7
|
|
|
8
|
-
gemspec path:
|
|
8
|
+
gemspec path: '../'
|
data/lib/enumerate_it/base.rb
CHANGED
|
@@ -42,7 +42,7 @@ module EnumerateIt
|
|
|
42
42
|
prefix_name = "#{attribute_name}_" if helpers.is_a?(Hash) && helpers[:prefix]
|
|
43
43
|
|
|
44
44
|
class_eval do
|
|
45
|
-
klass.enumeration.
|
|
45
|
+
klass.enumeration.each_key do |option|
|
|
46
46
|
define_method "#{prefix_name}#{option}?" do
|
|
47
47
|
send(attribute_name) == klass.enumeration[option].first
|
|
48
48
|
end
|
|
@@ -55,7 +55,7 @@ module EnumerateIt
|
|
|
55
55
|
|
|
56
56
|
prefix_name = "#{attribute_name}_" if helpers.is_a?(Hash) && helpers[:prefix]
|
|
57
57
|
|
|
58
|
-
klass.enumeration.
|
|
58
|
+
klass.enumeration.each_key do |key|
|
|
59
59
|
scope("#{prefix_name}#{key}", -> { where(attribute_name => klass.enumeration[key].first) })
|
|
60
60
|
end
|
|
61
61
|
end
|
data/lib/enumerate_it/version.rb
CHANGED
|
@@ -17,6 +17,10 @@ describe EnumerateIt::Base do
|
|
|
17
17
|
expect(TestEnumerationWithDash::PT_BR).to eq('pt-BR')
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
it 'creates constants for values with spaces' do
|
|
21
|
+
expect(TestEnumerationWithSpaces::SPA_CES).to eq('spa ces')
|
|
22
|
+
end
|
|
23
|
+
|
|
20
24
|
describe '.list' do
|
|
21
25
|
it "creates a method that returns the allowed values in the enumeration's class" do
|
|
22
26
|
expect(TestEnumeration.list).to eq(%w[1 2 3])
|
|
@@ -247,7 +251,7 @@ describe EnumerateIt::Base do
|
|
|
247
251
|
attr_accessor :bla
|
|
248
252
|
|
|
249
253
|
class << self
|
|
250
|
-
def validates_inclusion_of(
|
|
254
|
+
def validates_inclusion_of(_attribute)
|
|
251
255
|
true
|
|
252
256
|
end
|
|
253
257
|
|
data/spec/enumerate_it_spec.rb
CHANGED
|
@@ -259,7 +259,7 @@ describe EnumerateIt do
|
|
|
259
259
|
end
|
|
260
260
|
|
|
261
261
|
it 'creates a scope for each enumeration value' do
|
|
262
|
-
TestEnumeration.enumeration.
|
|
262
|
+
TestEnumeration.enumeration.each_key do |symbol|
|
|
263
263
|
expect(TestClassWithScope).to respond_to(symbol)
|
|
264
264
|
end
|
|
265
265
|
end
|
|
@@ -295,7 +295,7 @@ describe EnumerateIt do
|
|
|
295
295
|
end
|
|
296
296
|
|
|
297
297
|
it 'creates a scope with prefix for each enumeration value' do
|
|
298
|
-
TestEnumerationWithReservedWords.enumeration.
|
|
298
|
+
TestEnumerationWithReservedWords.enumeration.each_key do |symbol|
|
|
299
299
|
expect(OtherTestClass).to respond_to(:"foobar_#{symbol}")
|
|
300
300
|
end
|
|
301
301
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -34,6 +34,10 @@ class TestEnumerationWithCamelCase < EnumerateIt::Base
|
|
|
34
34
|
associate_values 'iPhone'
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
+
class TestEnumerationWithSpaces < EnumerateIt::Base
|
|
38
|
+
associate_values 'spa ces'
|
|
39
|
+
end
|
|
40
|
+
|
|
37
41
|
class Foobar < EnumerateIt::Base
|
|
38
42
|
associate_values bar: 'foo'
|
|
39
43
|
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
|
+
version: 1.7.0
|
|
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:
|
|
12
|
+
date: 2018-03-12 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|
|
@@ -155,7 +155,6 @@ files:
|
|
|
155
155
|
- README.md
|
|
156
156
|
- Rakefile
|
|
157
157
|
- enumerate_it.gemspec
|
|
158
|
-
- gemfiles/.bundle/config
|
|
159
158
|
- gemfiles/rails_3.0.gemfile
|
|
160
159
|
- gemfiles/rails_3.1.gemfile
|
|
161
160
|
- gemfiles/rails_3.2.gemfile
|
|
@@ -179,7 +178,8 @@ files:
|
|
|
179
178
|
- spec/spec_helper.rb
|
|
180
179
|
- spec/support/test_classes.rb
|
|
181
180
|
homepage: https://github.com/lucascaton/enumerate_it
|
|
182
|
-
licenses:
|
|
181
|
+
licenses:
|
|
182
|
+
- MIT
|
|
183
183
|
metadata: {}
|
|
184
184
|
post_install_message:
|
|
185
185
|
rdoc_options: []
|
|
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
197
197
|
version: '0'
|
|
198
198
|
requirements: []
|
|
199
199
|
rubyforge_project:
|
|
200
|
-
rubygems_version: 2.6
|
|
200
|
+
rubygems_version: 2.7.6
|
|
201
201
|
signing_key:
|
|
202
202
|
specification_version: 4
|
|
203
203
|
summary: Ruby Enumerations
|
data/gemfiles/.bundle/config
DELETED