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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4cccb1a5e9bf46985f887caa422c34401a0fcfd6b792b47e7a58ca1111ed6bef
4
- data.tar.gz: 9814c17b3483ebb7d5303eb95576e2f94321cae1cd4db219cb57da564316c43b
3
+ metadata.gz: a6408442138aafff2ca06cd0161a5fd34a10270a773fb6bd90a9cde54c593b66
4
+ data.tar.gz: 8dfb19dc5001ba6e7718cac33e0041eaef49747343a189138dd165f82b825bfb
5
5
  SHA512:
6
- metadata.gz: fdf4aa6edf57d80e1c6ba29db2b4776f6e6acab607962b093648fd3f6fad812c17d7f15d664b0fe14becd46bcd71f785ea643ad4ffdac2d61154011feb27471d
7
- data.tar.gz: 472bfcd22ebee89c2c15f789c90f1147d2938941283fc4a29400e7316de42166ffc34497ee7d1ec447e7be4e26cc3276c2e06d7260976fb3dc38633e808b85b0
6
+ metadata.gz: d26d78a27695eb0c4ca15055ada5624c802d4f22c9d7a5fb110b940bcf1bdc56f1bdcb65f0c4754820439bf94fcc6ba029dd1f922c6e53f9a07698a862b5d897
7
+ data.tar.gz: 5074fbbc002af0e8e7335a2a1e25bfbaa25923cdbc6171d177de5ebee6147236248f2d7efd86ca4d398ac2abf2b4a4873d49d2cd2a38bfde8cbf46fc6e8bc7b8
@@ -14,7 +14,7 @@ Metrics/MethodLength:
14
14
  Max: 25
15
15
 
16
16
  AllCops:
17
- TargetRubyVersion: 2.4
17
+ TargetRubyVersion: 2.3
18
18
 
19
19
  Metrics/AbcSize:
20
20
  Max: 16
@@ -4,6 +4,7 @@ env:
4
4
  language: ruby
5
5
  rvm:
6
6
  # Build on the latest stable of all supported Rubies (https://www.ruby-lang.org/en/downloads/):
7
+ - 2.3.8
7
8
  - 2.4.6
8
9
  - 2.5.5
9
10
  - 2.6.3
@@ -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:
@@ -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.4.6'
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.75.1')
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
@@ -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) ? Object.const_get(value) : value
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
@@ -8,5 +8,5 @@
8
8
  #
9
9
 
10
10
  module Dbee
11
- VERSION = '2.0.1'
11
+ VERSION = '2.0.2'
12
12
  end
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.1
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-10-15 00:00:00.000000000 Z
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.75.1
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.75.1
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.4.6
237
+ version: 2.3.8
238
238
  required_rubygems_version: !ruby/object:Gem::Requirement
239
239
  requirements:
240
240
  - - ">="