enumerations 2.3.1 → 2.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ce06adb418c77b2cfe89af486bff75362b4183bc
4
- data.tar.gz: e65afcbf46c76d46625443de26b52445a7a12a29
2
+ SHA256:
3
+ metadata.gz: b985b16b06e7879a3d5f06aad2ce71ee4ff17ba4f909e4b03b055ffbe63ef38f
4
+ data.tar.gz: 7281e76ed89746b3484203eb5c93e6f29d4e8cb08686fa895eaf60b3fa8a1186
5
5
  SHA512:
6
- metadata.gz: 168a363ddbbcf47dbe58f2024d455c6b5aae795360b92ad947d77f396ca25a4714067e4affb7e283d72ba80539d42f573d83cec68e68d2ba3d8334721f1e346e
7
- data.tar.gz: d09864e055364e4415870471d0ed16f2f00a7a2afbda0604f4d8dd37c65d165054de7524a5ac62f5173d71bd4c8eca4a626d6993ff06d4d6fa15d7ee1cab125f
6
+ metadata.gz: '09d4e8582c67a308d0fd327206fb084daa311d380fb0e270c5220cfbc054900308d9c68aab45189b63e8cea19a2885560a2a9f8be33177a7017d871491dee5aa'
7
+ data.tar.gz: cd317e0ebc64da8c2c11b85883dadfb0c91586164bb177382cbe6e8ee80dabfd71e2018ba0da84072ac6ee66c85b2e06345e24195c8143a054256591ec47a2cc
@@ -0,0 +1,113 @@
1
+ # Change Log
2
+
3
+ ## [v2.3.1](https://github.com/infinum/enumerations/tree/v2.3.1) (2017-09-08)
4
+ [Full Changelog](https://github.com/infinum/enumerations/compare/v2.3.0...v2.3.1)
5
+
6
+ ## [v2.3.0](https://github.com/infinum/enumerations/tree/v2.3.0) (2017-09-08)
7
+ [Full Changelog](https://github.com/infinum/enumerations/compare/v2.2.3...v2.3.0)
8
+
9
+ **Implemented enhancements:**
10
+
11
+ - Setting attribute to nil if enumeration value is unknown - surprising? [\#35](https://github.com/infinum/enumerations/issues/35)
12
+ - Add `without` methods [\#31](https://github.com/infinum/enumerations/issues/31)
13
+ - Add methods with '?' [\#19](https://github.com/infinum/enumerations/issues/19)
14
+ - Add with\_enumeration\(enumeration\) scope [\#18](https://github.com/infinum/enumerations/issues/18)
15
+
16
+ **Closed issues:**
17
+
18
+ - Not assigning the enumeration when tweaking the primary and foreign key [\#32](https://github.com/infinum/enumerations/issues/32)
19
+ - Undocumented feature - can't set attribute if it's not in the enumeration [\#30](https://github.com/infinum/enumerations/issues/30)
20
+
21
+ **Merged pull requests:**
22
+
23
+ - Feature/raising error on invalid enumeration value [\#38](https://github.com/infinum/enumerations/pull/38) ([PetarCurkovic](https://github.com/PetarCurkovic))
24
+ - Bugfix/config options [\#37](https://github.com/infinum/enumerations/pull/37) ([PetarCurkovic](https://github.com/PetarCurkovic))
25
+ - Feature/predicate methods for attributes [\#36](https://github.com/infinum/enumerations/pull/36) ([PetarCurkovic](https://github.com/PetarCurkovic))
26
+ - Feature/without scopes [\#34](https://github.com/infinum/enumerations/pull/34) ([PetarCurkovic](https://github.com/PetarCurkovic))
27
+ - Feature/with enumeration scope [\#33](https://github.com/infinum/enumerations/pull/33) ([PetarCurkovic](https://github.com/PetarCurkovic))
28
+
29
+ ## [v2.2.3](https://github.com/infinum/enumerations/tree/v2.2.3) (2017-03-17)
30
+ [Full Changelog](https://github.com/infinum/enumerations/compare/v2.2.2...v2.2.3)
31
+
32
+ ## [v2.2.2](https://github.com/infinum/enumerations/tree/v2.2.2) (2017-03-01)
33
+ [Full Changelog](https://github.com/infinum/enumerations/compare/v2.2.1...v2.2.2)
34
+
35
+ **Implemented enhancements:**
36
+
37
+ - Add id and quoted\_id methods [\#20](https://github.com/infinum/enumerations/issues/20)
38
+
39
+ **Fixed bugs:**
40
+
41
+ - Error when assiging nil [\#21](https://github.com/infinum/enumerations/issues/21)
42
+
43
+ **Closed issues:**
44
+
45
+ - upgrade to new codeclimate reporter [\#25](https://github.com/infinum/enumerations/issues/25)
46
+ - Giving a invalid enum name raises an error [\#23](https://github.com/infinum/enumerations/issues/23)
47
+ - Make second argument to Enumerations.value optional [\#22](https://github.com/infinum/enumerations/issues/22)
48
+
49
+ **Merged pull requests:**
50
+
51
+ - Make second argument to Enumerations.value optional [\#28](https://github.com/infinum/enumerations/pull/28) ([domagojnakic](https://github.com/domagojnakic))
52
+ - Fix giving invalid enum name raises error [\#27](https://github.com/infinum/enumerations/pull/27) ([domagojnakic](https://github.com/domagojnakic))
53
+ - Replaced CodeClimate::TestReporter with SimpleCov [\#26](https://github.com/infinum/enumerations/pull/26) ([PetarCurkovic](https://github.com/PetarCurkovic))
54
+ - Add migration readme [\#24](https://github.com/infinum/enumerations/pull/24) ([Narayanan170](https://github.com/Narayanan170))
55
+
56
+ ## [v2.2.1](https://github.com/infinum/enumerations/tree/v2.2.1) (2016-09-20)
57
+ [Full Changelog](https://github.com/infinum/enumerations/compare/v2.2.0...v2.2.1)
58
+
59
+ **Closed issues:**
60
+
61
+ - Add option to store foreign\_key as string [\#14](https://github.com/infinum/enumerations/issues/14)
62
+
63
+ **Merged pull requests:**
64
+
65
+ - Bugfix/empty initializer [\#17](https://github.com/infinum/enumerations/pull/17) ([PetarCurkovic](https://github.com/PetarCurkovic))
66
+
67
+ ## [v2.2.0](https://github.com/infinum/enumerations/tree/v2.2.0) (2016-09-19)
68
+ [Full Changelog](https://github.com/infinum/enumerations/compare/v2.1.0...v2.2.0)
69
+
70
+ **Merged pull requests:**
71
+
72
+ - Feature/remove [\#16](https://github.com/infinum/enumerations/pull/16) ([PetarCurkovic](https://github.com/PetarCurkovic))
73
+
74
+ ## [v2.1.0](https://github.com/infinum/enumerations/tree/v2.1.0) (2016-08-19)
75
+ [Full Changelog](https://github.com/infinum/enumerations/compare/v2.0.0...v2.1.0)
76
+
77
+ **Closed issues:**
78
+
79
+ - Moved all back to Base [\#9](https://github.com/infinum/enumerations/issues/9)
80
+ - I18n.locale [\#6](https://github.com/infinum/enumerations/issues/6)
81
+ - Case statement [\#3](https://github.com/infinum/enumerations/issues/3)
82
+
83
+ **Merged pull requests:**
84
+
85
+ - Feature/where filtering [\#13](https://github.com/infinum/enumerations/pull/13) ([PetarCurkovic](https://github.com/PetarCurkovic))
86
+ - Feature/localized attributes [\#12](https://github.com/infinum/enumerations/pull/12) ([PetarCurkovic](https://github.com/PetarCurkovic))
87
+
88
+ ## [v2.0.0](https://github.com/infinum/enumerations/tree/v2.0.0) (2016-08-17)
89
+ [Full Changelog](https://github.com/infinum/enumerations/compare/v1.3.0...v2.0.0)
90
+
91
+ **Merged pull requests:**
92
+
93
+ - Update version to 2.0.0 [\#11](https://github.com/infinum/enumerations/pull/11) ([PetarCurkovic](https://github.com/PetarCurkovic))
94
+ - Refactor [\#10](https://github.com/infinum/enumerations/pull/10) ([PetarCurkovic](https://github.com/PetarCurkovic))
95
+
96
+ ## [v1.3.0](https://github.com/infinum/enumerations/tree/v1.3.0) (2016-08-11)
97
+ [Full Changelog](https://github.com/infinum/enumerations/compare/v1.1.1...v1.3.0)
98
+
99
+ ## [v1.1.1](https://github.com/infinum/enumerations/tree/v1.1.1) (2016-06-07)
100
+ [Full Changelog](https://github.com/infinum/enumerations/compare/v1.1.0...v1.1.1)
101
+
102
+ **Merged pull requests:**
103
+
104
+ - Bugfix/value-id [\#8](https://github.com/infinum/enumerations/pull/8) ([nikajukic](https://github.com/nikajukic))
105
+ - Document configuration options [\#7](https://github.com/infinum/enumerations/pull/7) ([stankec](https://github.com/stankec))
106
+ - Refactoring all around [\#5](https://github.com/infinum/enumerations/pull/5) ([janvarljen](https://github.com/janvarljen))
107
+ - Added value method and support for custom attributes [\#4](https://github.com/infinum/enumerations/pull/4) ([PetarCurkovic](https://github.com/PetarCurkovic))
108
+ - Some refactoring and updated README [\#2](https://github.com/infinum/enumerations/pull/2) ([PetarCurkovic](https://github.com/PetarCurkovic))
109
+
110
+ ## [v1.1.0](https://github.com/infinum/enumerations/tree/v1.1.0) (2012-08-19)
111
+ **Merged pull requests:**
112
+
113
+ - Gemspec. [\#1](https://github.com/infinum/enumerations/pull/1) ([neektza](https://github.com/neektza))
File without changes
@@ -2,9 +2,9 @@ Enumerations
2
2
  ============
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/enumerations.svg)](https://badge.fury.io/rb/enumerations)
5
- [![Code Climate](https://codeclimate.com/github/infinum/enumerations/badges/gpa.svg)](https://codeclimate.com/github/infinum/enumerations)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/c3b96c5afceaa9be2173/maintainability)](https://codeclimate.com/github/infinum/enumerations/maintainability)
6
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/c3b96c5afceaa9be2173/test_coverage)](https://codeclimate.com/github/infinum/enumerations/test_coverage)
6
7
  [![Build Status](https://semaphoreci.com/api/v1/infinum/enumerations/branches/master/shields_badge.svg)](https://semaphoreci.com/infinum/enumerations)
7
- [![Test Coverage](https://codeclimate.com/github/infinum/enumerations/badges/coverage.svg)](https://codeclimate.com/github/infinum/enumerations/coverage)
8
8
 
9
9
  Rails plugin for Enumerations in ActiveRecord models.
10
10
 
@@ -399,7 +399,7 @@ Credits
399
399
  =======
400
400
  **Enumerations** is maintained and sponsored by [Infinum](https://infinum.co)
401
401
 
402
- Copyright © 2016 Infinum Ltd.
402
+ Copyright © 2010 - 2018 Infinum Ltd.
403
403
 
404
404
  License
405
405
  =======
@@ -22,8 +22,8 @@ Gem::Specification.new do |s|
22
22
  s.add_dependency 'i18n'
23
23
  s.add_development_dependency 'pry-byebug'
24
24
  s.add_development_dependency 'rake'
25
- s.add_development_dependency 'codeclimate-test-reporter', '~> 1.0'
26
- s.add_development_dependency 'sqlite3'
25
+ s.add_development_dependency 'simplecov'
26
+ s.add_development_dependency 'sqlite3', '~> 1.3.6'
27
27
 
28
28
  s.files = `git ls-files`.split("\n")
29
29
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -52,6 +52,15 @@ module Enumerations
52
52
  _enumerations
53
53
  end
54
54
 
55
+ def fetch_foreign_key_values(reflection, *symbols)
56
+ symbols.flatten.map do |symbol|
57
+ enumeration_value = reflection.enumerator_class.find(symbol)
58
+
59
+ enumeration_value &&
60
+ enumeration_value.send(reflection.enumerator_class.primary_key || :symbol)
61
+ end
62
+ end
63
+
55
64
  private
56
65
 
57
66
  def add_enumeration(reflection)
@@ -150,15 +159,6 @@ module Enumerations
150
159
  where.not(reflection.foreign_key => fetch_foreign_key_values(reflection, symbols))
151
160
  end)
152
161
  end
153
-
154
- def fetch_foreign_key_values(reflection, *symbols)
155
- symbols.flatten.map do |symbol|
156
- enumeration_value = reflection.enumerator_class.find(symbol)
157
-
158
- enumeration_value &&
159
- enumeration_value.send(reflection.enumerator_class.primary_key || :symbol)
160
- end
161
- end
162
162
  end
163
163
  end
164
164
 
@@ -1,3 +1,3 @@
1
1
  module Enumerations
2
- VERSION = '2.3.1'.freeze
2
+ VERSION = '2.3.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enumerations
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomislav Car
@@ -85,33 +85,33 @@ dependencies:
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  - !ruby/object:Gem::Dependency
88
- name: codeclimate-test-reporter
88
+ name: simplecov
89
89
  requirement: !ruby/object:Gem::Requirement
90
90
  requirements:
91
- - - "~>"
91
+ - - ">="
92
92
  - !ruby/object:Gem::Version
93
- version: '1.0'
93
+ version: '0'
94
94
  type: :development
95
95
  prerelease: false
96
96
  version_requirements: !ruby/object:Gem::Requirement
97
97
  requirements:
98
- - - "~>"
98
+ - - ">="
99
99
  - !ruby/object:Gem::Version
100
- version: '1.0'
100
+ version: '0'
101
101
  - !ruby/object:Gem::Dependency
102
102
  name: sqlite3
103
103
  requirement: !ruby/object:Gem::Requirement
104
104
  requirements:
105
- - - ">="
105
+ - - "~>"
106
106
  - !ruby/object:Gem::Version
107
- version: '0'
107
+ version: 1.3.6
108
108
  type: :development
109
109
  prerelease: false
110
110
  version_requirements: !ruby/object:Gem::Requirement
111
111
  requirements:
112
- - - ">="
112
+ - - "~>"
113
113
  - !ruby/object:Gem::Version
114
- version: '0'
114
+ version: 1.3.6
115
115
  description: Extends ActiveRecord with enumeration capabilites.
116
116
  email:
117
117
  - tomislav@infinum.hr
@@ -125,10 +125,11 @@ extra_rdoc_files: []
125
125
  files:
126
126
  - ".gitignore"
127
127
  - ".rubocop.yml"
128
+ - CHANGELOG.md
128
129
  - Gemfile
129
- - Migrate.md
130
+ - MIGRATE.md
131
+ - README.md
130
132
  - Rakefile
131
- - Readme.md
132
133
  - enumerations.gemspec
133
134
  - lib/enumerations.rb
134
135
  - lib/enumerations/base.rb
@@ -172,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
173
  version: '0'
173
174
  requirements: []
174
175
  rubyforge_project:
175
- rubygems_version: 2.6.11
176
+ rubygems_version: 2.7.6
176
177
  signing_key:
177
178
  specification_version: 4
178
179
  summary: Enumerations for ActiveRecord!