config_default 0.2.3 → 0.2.5

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
2
  SHA256:
3
- metadata.gz: c6d364e12aa53e53403e1d07d97af5e4aa8bf3ebad0e68d89b208aa5e0d3d36e
4
- data.tar.gz: 8d0a52621b05763871f6f08f45280a6d5098c331e2678def37195d870c7e3c77
3
+ metadata.gz: c668f11a0329c689b17ce83c7f656efba30e31ecbe4c277602df2a623ce5395f
4
+ data.tar.gz: edc20362637a4ee07b9db2f6bdc41d60841ad40b5af6e29b1edf1990664deec1
5
5
  SHA512:
6
- metadata.gz: 33fff861a6c04f26f96ba558b08bcc1d085391a0a296e519b83cba6386bd32fa6b57cc541eb2ec7acd90623556b0679a39b314cecdaf82870e54580ea76d858e
7
- data.tar.gz: 76c86562331604f05c83bbc31e273216d46074785bb29f3eae875f9f22be975ef6b72ae466b32a0a9cc70a5eea3570bea5fed392130eff48e0d740ba1b8f0d23
6
+ metadata.gz: 4d060c70fe676be1172615599c64ba5c59f3b03c3b9313c5758e5724dd256c02def5b05697f44b39c17c1fdc352753f1dc6b32cc74e41ac51cd446f440683252
7
+ data.tar.gz: 2a8133cb3fe79507af9dc42c9d86aaa96e8d47f5cf1a82b67ff58eddb5027adb8e4a81f2364fc566659f2b22497dd60a5078d0ca668dd836155f09180f1b70c5
@@ -24,7 +24,7 @@ jobs:
24
24
 
25
25
  strategy:
26
26
  matrix:
27
- ruby: [2.7, 3.0, 3.1]
27
+ ruby: [2.7, 3.0, 3.1, 3.2]
28
28
 
29
29
  steps:
30
30
  - uses: actions/checkout@v2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## 0.2.5
2
+
3
+ - Remove `attributes` keyword.
4
+ - Development dependency gems upgrade.
5
+
6
+ ## 0.2.4
7
+
8
+ - Avoid `symbolize_keys' for nil:NilClass error.
9
+
10
+ ## 0.2.3
11
+
12
+ - Moving to ArgumentError for better semantics.
13
+
14
+ ## 0.2.1
15
+
16
+ - Better rails monkey path apply. Rails extension classes without namespace.
17
+
18
+ ## 0.2.0
19
+
20
+ - New gem version with better code organization.
21
+
1
22
  ## 0.1.2
2
23
 
3
24
  - Move config struct option definition from `#method_missing` to `#define_singleton_method`
data/Gemfile.lock CHANGED
@@ -1,73 +1,73 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- config_default (0.2.3)
4
+ config_default (0.2.5)
5
5
  activesupport (>= 6)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (7.0.1)
11
- actionpack (= 7.0.1)
12
- activesupport (= 7.0.1)
10
+ actioncable (7.0.5)
11
+ actionpack (= 7.0.5)
12
+ activesupport (= 7.0.5)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailbox (7.0.1)
16
- actionpack (= 7.0.1)
17
- activejob (= 7.0.1)
18
- activerecord (= 7.0.1)
19
- activestorage (= 7.0.1)
20
- activesupport (= 7.0.1)
15
+ actionmailbox (7.0.5)
16
+ actionpack (= 7.0.5)
17
+ activejob (= 7.0.5)
18
+ activerecord (= 7.0.5)
19
+ activestorage (= 7.0.5)
20
+ activesupport (= 7.0.5)
21
21
  mail (>= 2.7.1)
22
22
  net-imap
23
23
  net-pop
24
24
  net-smtp
25
- actionmailer (7.0.1)
26
- actionpack (= 7.0.1)
27
- actionview (= 7.0.1)
28
- activejob (= 7.0.1)
29
- activesupport (= 7.0.1)
25
+ actionmailer (7.0.5)
26
+ actionpack (= 7.0.5)
27
+ actionview (= 7.0.5)
28
+ activejob (= 7.0.5)
29
+ activesupport (= 7.0.5)
30
30
  mail (~> 2.5, >= 2.5.4)
31
31
  net-imap
32
32
  net-pop
33
33
  net-smtp
34
34
  rails-dom-testing (~> 2.0)
35
- actionpack (7.0.1)
36
- actionview (= 7.0.1)
37
- activesupport (= 7.0.1)
38
- rack (~> 2.0, >= 2.2.0)
35
+ actionpack (7.0.5)
36
+ actionview (= 7.0.5)
37
+ activesupport (= 7.0.5)
38
+ rack (~> 2.0, >= 2.2.4)
39
39
  rack-test (>= 0.6.3)
40
40
  rails-dom-testing (~> 2.0)
41
41
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
42
- actiontext (7.0.1)
43
- actionpack (= 7.0.1)
44
- activerecord (= 7.0.1)
45
- activestorage (= 7.0.1)
46
- activesupport (= 7.0.1)
42
+ actiontext (7.0.5)
43
+ actionpack (= 7.0.5)
44
+ activerecord (= 7.0.5)
45
+ activestorage (= 7.0.5)
46
+ activesupport (= 7.0.5)
47
47
  globalid (>= 0.6.0)
48
48
  nokogiri (>= 1.8.5)
49
- actionview (7.0.1)
50
- activesupport (= 7.0.1)
49
+ actionview (7.0.5)
50
+ activesupport (= 7.0.5)
51
51
  builder (~> 3.1)
52
52
  erubi (~> 1.4)
53
53
  rails-dom-testing (~> 2.0)
54
54
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
55
- activejob (7.0.1)
56
- activesupport (= 7.0.1)
55
+ activejob (7.0.5)
56
+ activesupport (= 7.0.5)
57
57
  globalid (>= 0.3.6)
58
- activemodel (7.0.1)
59
- activesupport (= 7.0.1)
60
- activerecord (7.0.1)
61
- activemodel (= 7.0.1)
62
- activesupport (= 7.0.1)
63
- activestorage (7.0.1)
64
- actionpack (= 7.0.1)
65
- activejob (= 7.0.1)
66
- activerecord (= 7.0.1)
67
- activesupport (= 7.0.1)
58
+ activemodel (7.0.5)
59
+ activesupport (= 7.0.5)
60
+ activerecord (7.0.5)
61
+ activemodel (= 7.0.5)
62
+ activesupport (= 7.0.5)
63
+ activestorage (7.0.5)
64
+ actionpack (= 7.0.5)
65
+ activejob (= 7.0.5)
66
+ activerecord (= 7.0.5)
67
+ activesupport (= 7.0.5)
68
68
  marcel (~> 1.0)
69
69
  mini_mime (>= 1.1.0)
70
- activesupport (7.0.1)
70
+ activesupport (7.0.5)
71
71
  concurrent-ruby (~> 1.0, >= 1.0.2)
72
72
  i18n (>= 1.6, < 2)
73
73
  minitest (>= 5.1)
@@ -75,142 +75,147 @@ GEM
75
75
  ast (2.4.2)
76
76
  builder (3.2.4)
77
77
  coderay (1.1.3)
78
- concurrent-ruby (1.1.9)
78
+ concurrent-ruby (1.2.2)
79
79
  crass (1.0.6)
80
+ date (3.3.3)
80
81
  diff-lcs (1.5.0)
81
- digest (3.1.0)
82
- erubi (1.10.0)
83
- globalid (1.0.0)
82
+ erubi (1.12.0)
83
+ globalid (1.1.0)
84
84
  activesupport (>= 5.0)
85
- i18n (1.8.11)
85
+ i18n (1.14.1)
86
86
  concurrent-ruby (~> 1.0)
87
- io-wait (0.2.1)
88
- loofah (2.13.0)
87
+ json (2.6.3)
88
+ loofah (2.21.3)
89
89
  crass (~> 1.0.2)
90
- nokogiri (>= 1.5.9)
91
- mail (2.7.1)
90
+ nokogiri (>= 1.12.0)
91
+ mail (2.8.1)
92
92
  mini_mime (>= 0.1.1)
93
+ net-imap
94
+ net-pop
95
+ net-smtp
93
96
  marcel (1.0.2)
94
97
  method_source (1.0.0)
95
98
  mini_mime (1.1.2)
96
- minitest (5.15.0)
97
- net-imap (0.2.3)
98
- digest
99
+ minitest (5.18.0)
100
+ net-imap (0.3.4)
101
+ date
99
102
  net-protocol
100
- strscan
101
- net-pop (0.1.1)
102
- digest
103
+ net-pop (0.1.2)
103
104
  net-protocol
105
+ net-protocol (0.2.1)
104
106
  timeout
105
- net-protocol (0.1.2)
106
- io-wait
107
- timeout
108
- net-smtp (0.3.1)
109
- digest
107
+ net-smtp (0.3.3)
110
108
  net-protocol
111
- timeout
112
- nio4r (2.5.8)
113
- nokogiri (1.13.1-x86_64-darwin)
109
+ nio4r (2.5.9)
110
+ nokogiri (1.15.2-arm64-darwin)
111
+ racc (~> 1.4)
112
+ nokogiri (1.15.2-x86_64-darwin)
114
113
  racc (~> 1.4)
115
- nokogiri (1.13.1-x86_64-linux)
114
+ nokogiri (1.15.2-x86_64-linux)
116
115
  racc (~> 1.4)
117
- parallel (1.21.0)
118
- parser (3.1.0.0)
116
+ parallel (1.23.0)
117
+ parser (3.2.2.3)
119
118
  ast (~> 2.4.1)
120
- pry (0.14.1)
119
+ racc
120
+ pry (0.14.2)
121
121
  coderay (~> 1.1)
122
122
  method_source (~> 1.0)
123
- racc (1.6.0)
124
- rack (2.2.3)
125
- rack-test (1.1.0)
126
- rack (>= 1.0, < 3)
127
- rails (7.0.1)
128
- actioncable (= 7.0.1)
129
- actionmailbox (= 7.0.1)
130
- actionmailer (= 7.0.1)
131
- actionpack (= 7.0.1)
132
- actiontext (= 7.0.1)
133
- actionview (= 7.0.1)
134
- activejob (= 7.0.1)
135
- activemodel (= 7.0.1)
136
- activerecord (= 7.0.1)
137
- activestorage (= 7.0.1)
138
- activesupport (= 7.0.1)
123
+ racc (1.7.0)
124
+ rack (2.2.7)
125
+ rack-test (2.1.0)
126
+ rack (>= 1.3)
127
+ rails (7.0.5)
128
+ actioncable (= 7.0.5)
129
+ actionmailbox (= 7.0.5)
130
+ actionmailer (= 7.0.5)
131
+ actionpack (= 7.0.5)
132
+ actiontext (= 7.0.5)
133
+ actionview (= 7.0.5)
134
+ activejob (= 7.0.5)
135
+ activemodel (= 7.0.5)
136
+ activerecord (= 7.0.5)
137
+ activestorage (= 7.0.5)
138
+ activesupport (= 7.0.5)
139
139
  bundler (>= 1.15.0)
140
- railties (= 7.0.1)
140
+ railties (= 7.0.5)
141
141
  rails-dom-testing (2.0.3)
142
142
  activesupport (>= 4.2.0)
143
143
  nokogiri (>= 1.6)
144
- rails-html-sanitizer (1.4.2)
145
- loofah (~> 2.3)
146
- railties (7.0.1)
147
- actionpack (= 7.0.1)
148
- activesupport (= 7.0.1)
144
+ rails-html-sanitizer (1.6.0)
145
+ loofah (~> 2.21)
146
+ nokogiri (~> 1.14)
147
+ railties (7.0.5)
148
+ actionpack (= 7.0.5)
149
+ activesupport (= 7.0.5)
149
150
  method_source
150
151
  rake (>= 12.2)
151
152
  thor (~> 1.0)
152
153
  zeitwerk (~> 2.5)
153
154
  rainbow (3.1.1)
154
155
  rake (13.0.6)
155
- regexp_parser (2.2.0)
156
+ regexp_parser (2.8.0)
156
157
  rexml (3.2.5)
157
- rspec (3.10.0)
158
- rspec-core (~> 3.10.0)
159
- rspec-expectations (~> 3.10.0)
160
- rspec-mocks (~> 3.10.0)
161
- rspec-core (3.10.1)
162
- rspec-support (~> 3.10.0)
163
- rspec-expectations (3.10.2)
158
+ rspec (3.12.0)
159
+ rspec-core (~> 3.12.0)
160
+ rspec-expectations (~> 3.12.0)
161
+ rspec-mocks (~> 3.12.0)
162
+ rspec-core (3.12.2)
163
+ rspec-support (~> 3.12.0)
164
+ rspec-expectations (3.12.3)
164
165
  diff-lcs (>= 1.2.0, < 2.0)
165
- rspec-support (~> 3.10.0)
166
- rspec-mocks (3.10.2)
166
+ rspec-support (~> 3.12.0)
167
+ rspec-mocks (3.12.5)
167
168
  diff-lcs (>= 1.2.0, < 2.0)
168
- rspec-support (~> 3.10.0)
169
- rspec-support (3.10.3)
170
- rubocop (1.25.0)
169
+ rspec-support (~> 3.12.0)
170
+ rspec-support (3.12.0)
171
+ rubocop (1.50.2)
172
+ json (~> 2.3)
171
173
  parallel (~> 1.10)
172
- parser (>= 3.1.0.0)
174
+ parser (>= 3.2.0.0)
173
175
  rainbow (>= 2.2.2, < 4.0)
174
176
  regexp_parser (>= 1.8, < 3.0)
175
- rexml
176
- rubocop-ast (>= 1.15.1, < 2.0)
177
+ rexml (>= 3.2.5, < 4.0)
178
+ rubocop-ast (>= 1.28.0, < 2.0)
177
179
  ruby-progressbar (~> 1.7)
178
- unicode-display_width (>= 1.4.0, < 3.0)
179
- rubocop-ast (1.15.1)
180
- parser (>= 3.0.1.1)
181
- rubocop-config-umbrellio (1.25.0.61)
182
- rubocop (~> 1.25.0)
183
- rubocop-performance (~> 1.13.0)
184
- rubocop-rails (~> 2.13.0)
180
+ unicode-display_width (>= 2.4.0, < 3.0)
181
+ rubocop-ast (1.29.0)
182
+ parser (>= 3.2.1.0)
183
+ rubocop-capybara (2.18.0)
184
+ rubocop (~> 1.41)
185
+ rubocop-config-umbrellio (1.50.0.85)
186
+ rubocop (~> 1.50.0)
187
+ rubocop-performance (~> 1.17.0)
188
+ rubocop-rails (~> 2.19.0)
185
189
  rubocop-rake (~> 0.6.0)
186
- rubocop-rspec (~> 2.7.0)
190
+ rubocop-rspec (~> 2.20.0)
187
191
  rubocop-sequel (~> 0.3.3)
188
- rubocop-performance (1.13.2)
192
+ rubocop-performance (1.17.1)
189
193
  rubocop (>= 1.7.0, < 2.0)
190
194
  rubocop-ast (>= 0.4.0)
191
- rubocop-rails (2.13.2)
195
+ rubocop-rails (2.19.1)
192
196
  activesupport (>= 4.2.0)
193
197
  rack (>= 1.1)
194
- rubocop (>= 1.7.0, < 2.0)
198
+ rubocop (>= 1.33.0, < 2.0)
195
199
  rubocop-rake (0.6.0)
196
200
  rubocop (~> 1.0)
197
- rubocop-rspec (2.7.0)
198
- rubocop (~> 1.19)
199
- rubocop-sequel (0.3.3)
201
+ rubocop-rspec (2.20.0)
202
+ rubocop (~> 1.33)
203
+ rubocop-capybara (~> 2.17)
204
+ rubocop-sequel (0.3.4)
200
205
  rubocop (~> 1.0)
201
- ruby-progressbar (1.11.0)
202
- strscan (3.0.1)
203
- thor (1.2.1)
204
- timeout (0.2.0)
205
- tzinfo (2.0.4)
206
+ ruby-progressbar (1.13.0)
207
+ thor (1.2.2)
208
+ timeout (0.3.2)
209
+ tzinfo (2.0.6)
206
210
  concurrent-ruby (~> 1.0)
207
- unicode-display_width (2.1.0)
211
+ unicode-display_width (2.4.2)
208
212
  websocket-driver (0.7.5)
209
213
  websocket-extensions (>= 0.1.0)
210
214
  websocket-extensions (0.1.5)
211
- zeitwerk (2.5.3)
215
+ zeitwerk (2.6.8)
212
216
 
213
217
  PLATFORMS
218
+ arm64-darwin-22
214
219
  x86_64-darwin-20
215
220
  x86_64-darwin-21
216
221
  x86_64-linux
@@ -224,4 +229,4 @@ DEPENDENCIES
224
229
  rubocop-config-umbrellio
225
230
 
226
231
  BUNDLED WITH
227
- 2.2.28
232
+ 2.4.13
data/README.md CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  ConfigDefault is a simple way to separate your test/development config from your staging/production config.
4
4
  Designed to work with [Rails](https://github.com/rails/rails). It depends on `ActiveSupport`.
5
- Maybe in future I'll remove Rails dependency (cause it's never cool) and leave only ActiveSupport.
6
5
 
7
6
  ## Installation
8
7
 
@@ -171,7 +170,7 @@ Here an example of creation struct object on the fly:
171
170
 
172
171
  ```ruby
173
172
  config_on_the_fly = { first: { second: { third: "option" } } }
174
- config = ConfigDefault::Struct.new(attributes: config_on_the_fly, recursive: true)
173
+ config = ConfigDefault::Struct.new(config_on_the_fly, recursive: true)
175
174
  config.first.to_hash
176
175
  # => { "second" => { "third" => "option" } }
177
176
  config.first.second.third
@@ -3,7 +3,7 @@
3
3
  class ConfigDefault::Struct
4
4
  RESERVED_METHODS = %i[method_missing respond_to_missing? to_hash].freeze
5
5
 
6
- def initialize(attributes:, recursive: false, allow_nil: false)
6
+ def initialize(attributes, recursive: false, allow_nil: false)
7
7
  @attributes = ActiveSupport::HashWithIndifferentAccess.new(attributes)
8
8
  @allow_nil = allow_nil
9
9
  @recursive = recursive
@@ -47,11 +47,7 @@ class ConfigDefault::Struct
47
47
 
48
48
  @attributes.each do |key, value|
49
49
  next unless value.is_a?(Hash)
50
- @attributes[key] = self.class.new(
51
- attributes: value,
52
- recursive: @recursive,
53
- allow_nil: @allow_nil,
54
- )
50
+ @attributes[key] = self.class.new(value, recursive: @recursive, allow_nil: @allow_nil)
55
51
  end
56
52
  end
57
53
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ConfigDefault
4
- VERSION = "0.2.3"
4
+ VERSION = "0.2.5"
5
5
  end
@@ -31,6 +31,8 @@ module ConfigDefault
31
31
  data = default_config.deep_merge(config)
32
32
  data = key ? data[key] : data
33
33
 
34
+ return {} if data.nil?
35
+
34
36
  if deep_symbolize_keys
35
37
  data.deep_symbolize_keys
36
38
  elsif symbolize_keys
@@ -48,10 +50,7 @@ module ConfigDefault
48
50
  end
49
51
 
50
52
  def load_struct(name, key: Rails.env, recursive: false, allow_nil: false)
51
- ConfigDefault::Struct.new(
52
- attributes: load(name, key: key),
53
- recursive: recursive,
54
- allow_nil: allow_nil,
55
- )
53
+ attributes = load(name, key: key)
54
+ ConfigDefault::Struct.new(attributes, recursive: recursive, allow_nil: allow_nil)
56
55
  end
57
56
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: config_default
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stepan Kirushkin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-19 00:00:00.000000000 Z
11
+ date: 2023-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  requirements: []
76
- rubygems_version: 3.3.3
76
+ rubygems_version: 3.4.13
77
77
  signing_key:
78
78
  specification_version: 4
79
79
  summary: A simple way to manage default and env configuration in Rails.