dbee 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.travis.yml +1 -0
- data/CHANGELOG.md +10 -0
- data/dbee.gemspec +2 -2
- data/lib/dbee/dsl/association.rb +14 -1
- data/lib/dbee/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6408442138aafff2ca06cd0161a5fd34a10270a773fb6bd90a9cde54c593b66
|
4
|
+
data.tar.gz: 8dfb19dc5001ba6e7718cac33e0041eaef49747343a189138dd165f82b825bfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d26d78a27695eb0c4ca15055ada5624c802d4f22c9d7a5fb110b940bcf1bdc56f1bdcb65f0c4754820439bf94fcc6ba029dd1f922c6e53f9a07698a862b5d897
|
7
|
+
data.tar.gz: 5074fbbc002af0e8e7335a2a1e25bfbaa25923cdbc6171d177de5ebee6147236248f2d7efd86ca4d398ac2abf2b4a4873d49d2cd2a38bfde8cbf46fc6e8bc7b8
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
# 2.0.2 (November 7th, 2019)
|
2
|
+
|
3
|
+
### Additions:
|
4
|
+
|
5
|
+
* As of 2019-11-07, it is not recommended to use Ruby 2.3, but support was requested and added for Ruby 2.3.8. This is subject to being deprecated with next version.
|
6
|
+
|
7
|
+
### Fixes:
|
8
|
+
|
9
|
+
* Constantizing during inflection will now first check Object#const_defined? and if it is missing, it will now call Object#const_missing. This should work better with auto-loaded environments where constant names may collide, since Object#const_get will traverse down the entire hierarchy and may lead to false positives.
|
10
|
+
|
1
11
|
# 2.0.0 (September 3rd, 2019)
|
2
12
|
|
3
13
|
### Additions:
|
data/dbee.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.homepage = 'https://github.com/bluemarblepayroll/dbee'
|
20
20
|
s.license = 'MIT'
|
21
21
|
|
22
|
-
s.required_ruby_version = '>= 2.
|
22
|
+
s.required_ruby_version = '>= 2.3.8'
|
23
23
|
|
24
24
|
s.add_dependency('acts_as_hashable', '~>1', '>=1.1.0')
|
25
25
|
s.add_dependency('dry-inflector', '~>0')
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.add_development_dependency('pry', '~>0')
|
29
29
|
s.add_development_dependency('rake', '~> 13')
|
30
30
|
s.add_development_dependency('rspec')
|
31
|
-
s.add_development_dependency('rubocop', '~>0.
|
31
|
+
s.add_development_dependency('rubocop', '~>0.76.0')
|
32
32
|
s.add_development_dependency('simplecov', '~>0.17.0')
|
33
33
|
s.add_development_dependency('simplecov-console', '~>0.5.0')
|
34
34
|
end
|
data/lib/dbee/dsl/association.rb
CHANGED
@@ -41,12 +41,25 @@ module Dbee
|
|
41
41
|
opts[:model] || relative_class_name
|
42
42
|
end
|
43
43
|
|
44
|
+
# This will automatically prefix the name of the module within the current classes
|
45
|
+
# hierarchy. If the class does not happen to be in the same namespace then it needs
|
46
|
+
# to be explicitly set in the association using 'model' option.
|
44
47
|
def relative_class_name
|
45
48
|
(on_class_name.split('::')[0...-1] + [inflector.classify(name)]).join('::')
|
46
49
|
end
|
47
50
|
|
51
|
+
# Only use Module constant resolution if a string or symbol was passed in.
|
52
|
+
# Any other type is defined as an acceptable constant and is simply returned.
|
48
53
|
def constantize(value)
|
49
|
-
value.is_a?(String) || value.is_a?(Symbol) ?
|
54
|
+
value.is_a?(String) || value.is_a?(Symbol) ? object_constant(value) : value
|
55
|
+
end
|
56
|
+
|
57
|
+
# If the constant has been loaded, we can safely use it through const_get.
|
58
|
+
# If the constant has not been loaded, we need to defer to const_missing to resolve it.
|
59
|
+
# If we blindly call const_get, it may return false positives for namespaced constants
|
60
|
+
# or anything nested.
|
61
|
+
def object_constant(value)
|
62
|
+
Object.const_defined?(value) ? Object.const_get(value) : Object.const_missing(value)
|
50
63
|
end
|
51
64
|
end
|
52
65
|
end
|
data/lib/dbee/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Ruggio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: acts_as_hashable
|
@@ -106,14 +106,14 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 0.
|
109
|
+
version: 0.76.0
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: 0.
|
116
|
+
version: 0.76.0
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
118
|
name: simplecov
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -234,7 +234,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
234
234
|
requirements:
|
235
235
|
- - ">="
|
236
236
|
- !ruby/object:Gem::Version
|
237
|
-
version: 2.
|
237
|
+
version: 2.3.8
|
238
238
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
239
239
|
requirements:
|
240
240
|
- - ">="
|