dry-core 1.0.2 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36bbcb4408defe80fa90d925a7cb44f39a7e879bf0b2a8c81833e798a5446c63
4
- data.tar.gz: d15a43167c6de013170621a556a7d2845f79cb24e1d611359d17bf8918f2d0fd
3
+ metadata.gz: 01eb8881ff6cdd0f0249237b6a5bd70de5f4873dfb4303025a935b8d46174aa7
4
+ data.tar.gz: 910005d47b3e92f4ed503231ab5b082fe6bcf8e325c7957fc181bdb3c1b0faa9
5
5
  SHA512:
6
- metadata.gz: 8189675ea585094286244bef37ca1bc400eadf18a295e3d6a3beb23ed3e733c94a5bf8da8c3df001022244df2b2d1a68212370a6e248b53504d1a48726131a7f
7
- data.tar.gz: 70b957e62e938bee19922086549d3472ab36676d5e30cf6f671e88f844d1ce4787d4d71f4980875cbf6d8b5c4d79fe6eb7afe0a626b6bb38d45f28ddce18fec8
6
+ metadata.gz: bdcfc8d467da41c66238f9b95033d0db657a0212bc0406e1abf5e263854482c57023f2f2ab12bbda147ea52bbbbe53f8dd15dfda30a8dccb9ca0e8415cea76c0
7
+ data.tar.gz: 3df780e3e2f11ea288b6c5f1251d612640878d907a35bbac63e8d550ab73fc82e333e23da9d5f274000a9892ffc77663365e344d5f70ab303c5c6c9c2a17d2cd
data/CHANGELOG.md CHANGED
@@ -1,63 +1,92 @@
1
- <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
1
+ # Changelog
2
2
 
3
- ## 1.0.1 2023-08-06
3
+ All notable changes to this project will be documented in this file.
4
4
 
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Break Versioning](https://www.taoensso.com/break-versioning).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ ### Changed
13
+
14
+ ### Deprecated
15
+
16
+ ### Removed
5
17
 
6
18
  ### Fixed
7
19
 
8
- - [equalizer] Add `Dry::Core.Equalizer` method to make `include Dry::Core.Equalizer(...)` work as documented (via #79) (@timriley)
20
+ ### Security
9
21
 
10
- Users of Equalizer should now only need to `require "dry/core"` first.
22
+ [Unreleased]: https://github.com/dry-rb/dry-core/compare/v1.2.0...main
11
23
 
24
+ ## [1.2.0] - 2025-12-28
12
25
 
13
26
  ### Changed
14
27
 
15
- - Minimal Ruby version is 3.0
28
+ - Support Ruby 4.0 in `Dry::Core::BasicObject#inspect` and `#pretty_print` (by returning false from its default `#respond_to_missing?`). (@timriley in #87)
29
+ - Set minimum Ruby version to 3.2. (@timriley)
16
30
 
17
- [Compare v1.0.0...v1.0.1](https://github.com/dry-rb/dry-core/compare/v1.0.0...v1.0.1)
31
+ [1.2.0]: https://github.com/dry-rb/dry-core/compare/v1.1.0...v1.2.0
18
32
 
19
- ## 1.0.0 2022-11-04
33
+ ## [1.1.0] - 2025-01-04
20
34
 
35
+ ### Changed
21
36
 
22
- ### Added
37
+ - Minimal Ruby version is 3.1 (@flash-gordon)
38
+ - Fixed clash with `dry-logger` (see #80) (@flash-gordon)
23
39
 
24
- - Import dry-container as `Dry::Core::Container` (via #77) (@solnic)
40
+ [1.1.0]: https://github.com/dry-rb/dry-core/compare/v1.0.1...v1.1.0
25
41
 
42
+ ## [1.0.1] - 2023-08-06
26
43
 
27
- [Compare v0.9.1...v1.0.0](https://github.com/dry-rb/dry-core/compare/v0.9.1...v1.0.0)
44
+ ### Fixed
28
45
 
29
- ## 0.9.1 2022-10-18
46
+ - [equalizer] Add `Dry::Core.Equalizer` method to make `include Dry::Core.Equalizer(...)` work as documented (via #79) (@timriley)
30
47
 
48
+ Users of Equalizer should now only need to `require "dry/core"` first.
31
49
 
32
50
  ### Changed
33
51
 
34
- - Correct missing constant for IDENTITY (issue #75 fixed via #76) (@poloka)
52
+ - Minimal Ruby version is 3.0 (@flash-gordon)
53
+
54
+ [1.0.1]: https://github.com/dry-rb/dry-core/compare/v1.0.0...v1.0.1
55
+
56
+ ## [1.0.0] - 2022-11-04
57
+
58
+ ### Added
35
59
 
36
- [Compare v0.9.0...v0.9.1](https://github.com/dry-rb/dry-core/compare/v0.9.0...v0.9.1)
60
+ - Import dry-container as `Dry::Core::Container` (via #77) (@solnic)
37
61
 
38
- ## 0.9.0 2022-10-15
62
+ [1.0.0]: https://github.com/dry-rb/dry-core/compare/v0.9.1...v1.0.0
39
63
 
64
+ ## [0.9.1] - 2022-10-18
40
65
 
41
66
  ### Changed
42
67
 
43
- - dry-core now uses zeitwerk for autoloading (@solnic)
68
+ - Correct missing constant for IDENTITY (issue #75 fixed via #76) (@poloka)
44
69
 
45
- [Compare v0.8.1...v0.9.0](https://github.com/dry-rb/dry-core/compare/v0.8.1...v0.9.0)
70
+ [0.9.1]: https://github.com/dry-rb/dry-core/compare/v0.9.0...v0.9.1
46
71
 
47
- ## 0.8.1 2022-07-27
72
+ ## [0.9.0] - 2022-10-15
48
73
 
74
+ ### Changed
49
75
 
50
- ### Fixed
76
+ - dry-core now uses zeitwerk for autoloading (@solnic)
51
77
 
52
- - [memoizable] plays better with inheritance.
53
- There were cases when cached values from base claesses were used, see #70 (@flash-gordon)
78
+ [0.9.0]: https://github.com/dry-rb/dry-core/compare/v0.8.1...v0.9.0
54
79
 
80
+ ## [0.8.1] - 2022-07-27
55
81
 
82
+ ### Fixed
56
83
 
57
- [Compare v0.8.0...v0.8.1](https://github.com/dry-rb/dry-core/compare/v0.8.0...v0.8.1)
84
+ - [memoizable] plays better with inheritance.
85
+ There were cases when cached values from base claesses were used, see #70 (@flash-gordon)
58
86
 
59
- ## 0.8.0 2022-07-15
87
+ [0.8.1]: https://github.com/dry-rb/dry-core/compare/v0.8.0...v0.8.1
60
88
 
89
+ ## [0.8.0] - 2022-07-15
61
90
 
62
91
  ### Added
63
92
 
@@ -68,23 +97,18 @@ There were cases when cached values from base claesses were used, see #70 (@flas
68
97
  - [BREAKING] [descendants tracker] switch to using `Class#subclasses` on Ruby 3.1+.
69
98
  This changes the order of returned subclasses (immediate subclasses now go first) (@flash-gordon)
70
99
 
100
+ [0.8.0]: https://github.com/dry-rb/dry-core/compare/v0.7.1...v0.8.0
71
101
 
72
- [Compare v0.7.1...v0.8.0](https://github.com/dry-rb/dry-core/compare/v0.7.1...v0.8.0)
73
-
74
- ## 0.7.1 2021-07-10
75
-
102
+ ## [0.7.1] - 2021-07-10
76
103
 
77
104
  ### Fixed
78
105
 
79
106
  - [memoizable] memoizable correctly handles cases where a method
80
107
  has unnamed params (e.g. happens when the new `...` syntax is used) (@flash-gordon)
81
108
 
109
+ [0.7.1]: https://github.com/dry-rb/dry-core/compare/v0.7.0...v0.7.1
82
110
 
83
-
84
- [Compare v0.7.0...v0.7.1](https://github.com/dry-rb/dry-core/compare/v0.7.0...v0.7.1)
85
-
86
- ## 0.7.0 2021-07-08
87
-
111
+ ## [0.7.0] - 2021-07-08
88
112
 
89
113
  ### Fixed
90
114
 
@@ -96,10 +120,9 @@ has unnamed params (e.g. happens when the new `...` syntax is used) (@flash-gord
96
120
  - Minimal Ruby version is 2.6
97
121
  - [memoizable] memoization of block-accepting methods is deprecated (@flash-gordon)
98
122
 
99
- [Compare v0.6.0...v0.7.0](https://github.com/dry-rb/dry-core/compare/v0.6.0...v0.7.0)
100
-
101
- ## 0.6.0 2021-06-03
123
+ [0.7.0]: https://github.com/dry-rb/dry-core/compare/v0.6.0...v0.7.0
102
124
 
125
+ ## [0.6.0] - 2021-06-03
103
126
 
104
127
  ### Added
105
128
 
@@ -111,21 +134,17 @@ has unnamed params (e.g. happens when the new `...` syntax is used) (@flash-gord
111
134
 
112
135
  - [memoizable] works with MRI 2.7+ keyword arguments now (@oleander)
113
136
 
137
+ [0.6.0]: https://github.com/dry-rb/dry-core/compare/v0.5.0...v0.6.0
114
138
 
115
- [Compare v0.5.0...v0.6.0](https://github.com/dry-rb/dry-core/compare/v0.5.0...v0.6.0)
116
-
117
- ## 0.5.0 2020-12-12
118
-
139
+ ## [0.5.0] - 2020-12-12
119
140
 
120
141
  ### Added
121
142
 
122
143
  - dry-equalizer has been imported into dry-core as `Dry::Core::Equalizer` but the interface remains the same, which is `include Dry.Equalizer(...)` - we'll be porting all other gems that depend on dry-equalizer to the latest dry-core with equalizer included *gradually*. Eventually dry-equalizer usage will be gone completely in rom-rb/dry-rb/hanami projects (@solnic)
123
144
 
145
+ [0.5.0]: https://github.com/dry-rb/dry-core/compare/v0.4.10...v0.5.0
124
146
 
125
- [Compare v0.4.10...v0.5.0](https://github.com/dry-rb/dry-core/compare/v0.4.10...v0.5.0)
126
-
127
- ## 0.4.10 2020-11-19
128
-
147
+ ## [0.4.10] - 2020-11-19
129
148
 
130
149
  ### Added
131
150
 
@@ -143,11 +162,9 @@ defines :nodes, coerce: Dry::Types['coercible.integer']
143
162
  ```
144
163
  - `Constants::IDENTITY` which is the identity function (flash-gordon)
145
164
 
165
+ [0.4.10]: https://github.com/dry-rb/dry-core/compare/v0.4.9...v0.4.10
146
166
 
147
- [Compare v0.4.9...v0.4.10](https://github.com/dry-rb/dry-core/compare/v0.4.9...v0.4.10)
148
-
149
- ## 0.4.9 2019-08-09
150
-
167
+ ## [0.4.9] - 2019-08-09
151
168
 
152
169
  ### Added
153
170
 
@@ -161,11 +178,9 @@ defines :nodes, coerce: Dry::Types['coercible.integer']
161
178
 
162
179
  - `Undefined.{dup,clone}` returns `Undefined` back, `Undefined` is a singleton (flash-gordon)
163
180
 
181
+ [0.4.9]: https://github.com/dry-rb/dry-core/compare/v0.4.8...v0.4.9
164
182
 
165
- [Compare v0.4.8...v0.4.9](https://github.com/dry-rb/dry-core/compare/v0.4.8...v0.4.9)
166
-
167
- ## 0.4.8 2019-06-23
168
-
183
+ ## [0.4.8] - 2019-06-23
169
184
 
170
185
  ### Added
171
186
 
@@ -179,80 +194,66 @@ defines :nodes, coerce: Dry::Types['coercible.integer']
179
194
  Undefined.map(something) { |v| v + 1 } # => Undefined
180
195
  ```
181
196
 
197
+ [0.4.8]: https://github.com/dry-rb/dry-core/compare/v0.4.7...v0.4.8
182
198
 
183
- [Compare v0.4.7...v0.4.8](https://github.com/dry-rb/dry-core/compare/v0.4.7...v0.4.8)
184
-
185
- ## 0.4.7 2018-06-25
186
-
199
+ ## [0.4.7] - 2018-06-25
187
200
 
188
201
  ### Fixed
189
202
 
190
203
  - Fix default logger for deprecations, it now uses `$stderr` by default, as it should (flash-gordon)
191
204
 
205
+ [0.4.7]: https://github.com/dry-rb/dry-core/compare/v0.4.6...v0.4.7
192
206
 
193
- [Compare v0.4.6...v0.4.7](https://github.com/dry-rb/dry-core/compare/v0.4.6...v0.4.7)
194
-
195
- ## 0.4.6 2018-05-15
196
-
207
+ ## [0.4.6] - 2018-05-15
197
208
 
198
209
  ### Changed
199
210
 
200
211
  - Trigger constant autoloading in the class builder (radar)
201
212
 
202
- [Compare v0.4.5...v0.4.6](https://github.com/dry-rb/dry-core/compare/v0.4.5...v0.4.6)
203
-
204
- ## 0.4.5 2018-03-14
213
+ [0.4.6]: https://github.com/dry-rb/dry-core/compare/v0.4.5...v0.4.6
205
214
 
215
+ ## [0.4.5] - 2018-03-14
206
216
 
207
217
  ### Added
208
218
 
209
219
  - `Dry::Core::Memoizable`, which provides a `memoize` macro for memoizing results of instance methods (timriley)
210
220
 
221
+ [0.4.5]: https://github.com/dry-rb/dry-core/compare/v0.4.4...v0.4.5
211
222
 
212
- [Compare v0.4.4...v0.4.5](https://github.com/dry-rb/dry-core/compare/v0.4.4...v0.4.5)
213
-
214
- ## 0.4.4 2018-02-10
215
-
223
+ ## [0.4.4] - 2018-02-10
216
224
 
217
225
  ### Added
218
226
 
219
227
  - `deprecate_constant` overrides `Module#deprecate_constant` and issues a labeled message on accessing a deprecated constant (flash-gordon)
220
228
  - `Undefined.default` which accepts two arguments and returns the first if it's not `Undefined`; otherwise, returns the second one or yields a block (flash-gordon)
221
229
 
230
+ [0.4.4]: https://github.com/dry-rb/dry-core/compare/v0.4.3...v0.4.4
222
231
 
223
- [Compare v0.4.3...v0.4.4](https://github.com/dry-rb/dry-core/compare/v0.4.3...v0.4.4)
224
-
225
- ## 0.4.3 2018-02-03
226
-
232
+ ## [0.4.3] - 2018-02-03
227
233
 
228
234
  ### Added
229
235
 
230
236
  - `Dry::Core::DescendantsTracker` which is a maintained version of the [`descendants_tracker`](https://github.com/dkubb/descendants_tracker) gem (flash-gordon)
231
237
 
238
+ [0.4.3]: https://github.com/dry-rb/dry-core/compare/v0.4.2...v0.4.3
232
239
 
233
- [Compare v0.4.2...v0.4.3](https://github.com/dry-rb/dry-core/compare/v0.4.2...v0.4.3)
234
-
235
- ## 0.4.2 2017-12-16
236
-
240
+ ## [0.4.2] - 2017-12-16
237
241
 
238
242
  ### Fixed
239
243
 
240
244
  - Class attributes now support private setters/getters (flash-gordon)
241
245
 
246
+ [0.4.2]: https://github.com/dry-rb/dry-core/compare/v0.4.1...v0.4.2
242
247
 
243
- [Compare v0.4.1...v0.4.2](https://github.com/dry-rb/dry-core/compare/v0.4.1...v0.4.2)
244
-
245
- ## 0.4.1 2017-11-04
246
-
248
+ ## [0.4.1] - 2017-11-04
247
249
 
248
250
  ### Changed
249
251
 
250
252
  - Improved error message on invalid attribute value (GustavoCaso)
251
253
 
252
- [Compare v0.4.0...v0.4.1](https://github.com/dry-rb/dry-core/compare/v0.4.0...v0.4.1)
253
-
254
- ## 0.4.0 2017-11-02
254
+ [0.4.1]: https://github.com/dry-rb/dry-core/compare/v0.4.0...v0.4.1
255
255
 
256
+ ## [0.4.0] - 2017-11-02
256
257
 
257
258
  ### Added
258
259
 
@@ -267,104 +268,84 @@ defines :nodes, coerce: Dry::Types['coercible.integer']
267
268
  end
268
269
  ```
269
270
 
271
+ [0.4.0]: https://github.com/dry-rb/dry-core/compare/v0.3.4...v0.4.0
270
272
 
271
- [Compare v0.3.4...v0.4.0](https://github.com/dry-rb/dry-core/compare/v0.3.4...v0.4.0)
272
-
273
- ## 0.3.4 2017-09-29
274
-
273
+ ## [0.3.4] - 2017-09-29
275
274
 
276
275
  ### Fixed
277
276
 
278
277
  - `Deprecations` output is set to `$stderr` by default now (solnic)
279
278
 
279
+ [0.3.4]: https://github.com/dry-rb/dry-core/compare/v0.3.3...v0.3.4
280
280
 
281
- [Compare v0.3.3...v0.3.4](https://github.com/dry-rb/dry-core/compare/v0.3.3...v0.3.4)
282
-
283
- ## 0.3.3 2017-08-31
284
-
281
+ ## [0.3.3] - 2017-08-31
285
282
 
286
283
  ### Fixed
287
284
 
288
285
  - The Deprecations module now shows the right caller line (flash-gordon)
289
286
 
287
+ [0.3.3]: https://github.com/dry-rb/dry-core/compare/v0.3.2...v0.3.3
290
288
 
291
- [Compare v0.3.2...v0.3.3](https://github.com/dry-rb/dry-core/compare/v0.3.2...v0.3.3)
292
-
293
- ## 0.3.2 2017-08-31
294
-
289
+ ## [0.3.2] - 2017-08-31
295
290
 
296
291
  ### Added
297
292
 
298
293
  - Accept an existing logger object in `Dry::Core::Deprecations.set_logger!` (flash-gordon)
299
294
 
295
+ [0.3.2]: https://github.com/dry-rb/dry-core/compare/v0.3.1...v0.3.2
300
296
 
301
- [Compare v0.3.1...v0.3.2](https://github.com/dry-rb/dry-core/compare/v0.3.1...v0.3.2)
302
-
303
- ## 0.3.1 2017-05-27
304
-
297
+ ## [0.3.1] - 2017-05-27
305
298
 
306
299
  ### Added
307
300
 
308
301
  - Support for building classes within an existing namespace (flash-gordon)
309
302
 
303
+ [0.3.1]: https://github.com/dry-rb/dry-core/compare/v0.3.0...v0.3.1
310
304
 
311
- [Compare v0.3.0...v0.3.1](https://github.com/dry-rb/dry-core/compare/v0.3.0...v0.3.1)
312
-
313
- ## 0.3.0 2017-05-05
314
-
305
+ ## [0.3.0] - 2017-05-05
315
306
 
316
307
  ### Changed
317
308
 
318
309
  - Class attributes are initialized _before_ running the `inherited` hook. It's slightly more convenient behavior and it's very unlikely anyone will be affected by this, but technically this is a breaking change (flash-gordon)
319
310
 
320
- [Compare v0.2.4...v0.3.0](https://github.com/dry-rb/dry-core/compare/v0.2.4...v0.3.0)
321
-
322
- ## 0.2.4 2017-01-26
311
+ [0.3.0]: https://github.com/dry-rb/dry-core/compare/v0.2.4...v0.3.0
323
312
 
313
+ ## [0.2.4] - 2017-01-26
324
314
 
325
315
  ### Fixed
326
316
 
327
317
  - Do not require deprecated method to be defined (flash-gordon)
328
318
 
319
+ [0.2.4]: https://github.com/dry-rb/dry-core/compare/v0.2.3...v0.2.4
329
320
 
330
- [Compare v0.2.3...v0.2.4](https://github.com/dry-rb/dry-core/compare/v0.2.3...v0.2.4)
331
-
332
- ## 0.2.3 2016-12-30
333
-
321
+ ## [0.2.3] - 2016-12-30
334
322
 
335
323
  ### Fixed
336
324
 
337
325
  - Fix warnings on using uninitialized class attributes (flash-gordon)
338
326
 
327
+ [0.2.3]: https://github.com/dry-rb/dry-core/compare/v0.2.2...v0.2.3
339
328
 
340
- [Compare v0.2.2...v0.2.3](https://github.com/dry-rb/dry-core/compare/v0.2.2...v0.2.3)
341
-
342
- ## 0.2.2 2016-12-30
343
-
329
+ ## [0.2.2] - 2016-12-30
344
330
 
345
331
  ### Added
346
332
 
347
333
  - `ClassAttributes` which provides `defines` method for defining get-or-set methods (flash-gordon)
348
334
 
335
+ [0.2.2]: https://github.com/dry-rb/dry-core/compare/v0.2.1...v0.2.2
349
336
 
350
- [Compare v0.2.1...v0.2.2](https://github.com/dry-rb/dry-core/compare/v0.2.1...v0.2.2)
351
-
352
- ## 0.2.1 2016-11-18
353
-
337
+ ## [0.2.1] - 2016-11-18
354
338
 
355
339
  ### Added
356
340
 
357
341
  - `Constants` are now available in nested scopes (flash-gordon)
358
342
 
343
+ [0.2.1]: https://github.com/dry-rb/dry-core/compare/v0.2.0...v0.2.1
359
344
 
360
- [Compare v0.2.0...v0.2.1](https://github.com/dry-rb/dry-core/compare/v0.2.0...v0.2.1)
361
-
362
- ## 0.2.0 2016-11-01
363
-
364
-
345
+ ## [0.2.0] - 2016-11-01
365
346
 
366
- [Compare v0.1.0...v0.2.0](https://github.com/dry-rb/dry-core/compare/v0.1.0...v0.2.0)
347
+ [0.2.0]: https://github.com/dry-rb/dry-core/compare/v0.1.0...v0.2.0
367
348
 
368
- ## 0.1.0 2016-09-17
349
+ ## 0.1.0 - 2016-09-17
369
350
 
370
351
  Initial release
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2023 dry-rb team
3
+ Copyright (c) 2015-2025 Hanakai team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
@@ -18,3 +18,4 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
18
  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
19
  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
20
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
data/README.md CHANGED
@@ -1,22 +1,17 @@
1
- <!--- this file is synced from dry-rb/template-gem project -->
2
- [gem]: https://rubygems.org/gems/dry-core
1
+ <!--- This file is synced from hanakai-rb/repo-sync -->
2
+
3
+ [rubygem]: https://rubygems.org/gems/dry-core
3
4
  [actions]: https://github.com/dry-rb/dry-core/actions
4
5
 
5
- # dry-core [![Gem Version](https://badge.fury.io/rb/dry-core.svg)][gem] [![CI Status](https://github.com/dry-rb/dry-core/workflows/ci/badge.svg)][actions]
6
+ # dry-core [![Gem Version](https://badge.fury.io/rb/dry-core.svg)][rubygem] [![CI Status](https://github.com/dry-rb/dry-core/workflows/CI/badge.svg)][actions]
6
7
 
7
8
  ## Links
8
9
 
9
- * [User documentation](https://dry-rb.org/gems/dry-core)
10
- * [API documentation](http://rubydoc.info/gems/dry-core)
11
- * [Forum](https://discourse.dry-rb.org)
12
-
13
- ## Supported Ruby versions
14
-
15
- This library officially supports the following Ruby versions:
16
-
17
- * MRI `>= 3.0.0`
18
- * jruby `>= 9.4` (not tested on CI)
10
+ - [User documentation](https://dry-rb.org/gems/dry-core)
11
+ - [API documentation](http://rubydoc.info/gems/dry-core)
12
+ - [Forum](https://discourse.dry-rb.org)
19
13
 
20
14
  ## License
21
15
 
22
16
  See `LICENSE` file.
17
+
data/dry-core.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # this file is synced from dry-rb/template-gem project
3
+ # This file is synced from hanakai-rb/repo-sync. To update it, edit repo-sync.yml.
4
4
 
5
5
  lib = File.expand_path("lib", __dir__)
6
6
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
@@ -8,8 +8,8 @@ require "dry/core/version"
8
8
 
9
9
  Gem::Specification.new do |spec|
10
10
  spec.name = "dry-core"
11
- spec.authors = ["Nikita Shilnikov"]
12
- spec.email = ["fg@flashgordon.ru"]
11
+ spec.authors = ["Hanakai team"]
12
+ spec.email = ["info@hanakai.org"]
13
13
  spec.license = "MIT"
14
14
  spec.version = Dry::Core::VERSION.dup
15
15
 
@@ -21,19 +21,21 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = []
22
22
  spec.require_paths = ["lib"]
23
23
 
24
+ spec.extra_rdoc_files = ["README.md", "CHANGELOG.md", "LICENSE"]
25
+
24
26
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
25
27
  spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-core/blob/main/CHANGELOG.md"
26
28
  spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-core"
27
29
  spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-core/issues"
30
+ spec.metadata["funding_uri"] = "https://github.com/sponsors/hanami"
28
31
 
29
- spec.required_ruby_version = ">= 3.0.0"
32
+ spec.required_ruby_version = ">= 3.2"
30
33
 
31
- # to update dependencies edit project.yml
32
34
  spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
33
35
  spec.add_runtime_dependency "logger"
34
36
  spec.add_runtime_dependency "zeitwerk", "~> 2.6"
35
-
36
37
  spec.add_development_dependency "bundler"
37
38
  spec.add_development_dependency "rake"
38
39
  spec.add_development_dependency "rspec"
39
40
  end
41
+
@@ -121,18 +121,18 @@ module Dry
121
121
  # @since 0.8.0
122
122
  #
123
123
  # @see http://ruby-doc.org/core/Object.html#method-i-respond_to-3F
124
- def respond_to?(method_name, include_all = false) # rubocop:disable Style/OptionalBooleanParameter
124
+ def respond_to?(method_name, include_all = false)
125
125
  respond_to_missing?(method_name, include_all)
126
126
  end
127
127
 
128
128
  private
129
129
 
130
- # Must be overridden by descendants
130
+ # Can be overridden by descendants to customize respond_to? behavior
131
131
  #
132
132
  # @since 0.8.0
133
133
  # @api private
134
134
  def respond_to_missing?(_method_name, _include_all)
135
- ::Kernel.raise ::NotImplementedError
135
+ false
136
136
  end
137
137
 
138
138
  # @since 0.8.0
@@ -23,7 +23,7 @@ module Dry
23
23
  def self.extended(klass)
24
24
  super
25
25
  klass.include(Methods)
26
- klass.instance_variable_set(:@__cache__, Concurrent::Map.new)
26
+ klass.instance_variable_set(:@__cache__, ::Concurrent::Map.new)
27
27
  end
28
28
 
29
29
  # @api private
@@ -48,8 +48,8 @@ module Dry
48
48
  #
49
49
  # @return [Object] block's return value (cached for subsequent calls with
50
50
  # the same argument values)
51
- def fetch_or_store(*args, &block)
52
- cache.fetch_or_store(args.hash, &block)
51
+ def fetch_or_store(*args, &)
52
+ cache.fetch_or_store(args.hash, &)
53
53
  end
54
54
 
55
55
  # Instance methods
@@ -4,14 +4,14 @@ module Dry
4
4
  module Core
5
5
  # Class for generating more classes
6
6
  class ClassBuilder
7
- ParentClassMismatch = Class.new(TypeError)
7
+ ParentClassMismatch = ::Class.new(::TypeError)
8
8
 
9
9
  attr_reader :name, :parent, :namespace
10
10
 
11
11
  def initialize(name:, parent: nil, namespace: nil)
12
12
  @name = name
13
13
  @namespace = namespace
14
- @parent = parent || Object
14
+ @parent = parent || ::Object
15
15
  end
16
16
 
17
17
  # Generate a class based on options
@@ -48,7 +48,7 @@ module Dry
48
48
 
49
49
  # @api private
50
50
  def create_anonymous
51
- klass = Class.new(parent)
51
+ klass = ::Class.new(parent)
52
52
  name = self.name
53
53
 
54
54
  klass.singleton_class.class_eval do
@@ -64,7 +64,7 @@ module Dry
64
64
  def create_named
65
65
  name = self.name
66
66
  base = create_base(namespace, name, parent)
67
- klass = Class.new(base)
67
+ klass = ::Class.new(base)
68
68
 
69
69
  namespace.module_eval do
70
70
  remove_const(name)
@@ -93,7 +93,7 @@ module Dry
93
93
 
94
94
  existing
95
95
  else
96
- klass = Class.new(parent || Object)
96
+ klass = ::Class.new(parent || ::Object)
97
97
  namespace.const_set(name, klass)
98
98
  klass
99
99
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "set"
4
-
5
3
  module Dry
6
4
  module Core
7
5
  # A list of constants you can use to avoid memory allocations or identity checks.
@@ -27,7 +25,7 @@ module Dry
27
25
  # An empty string
28
26
  EMPTY_STRING = ""
29
27
  # Identity function
30
- IDENTITY = (-> x { x }).freeze
28
+ IDENTITY = ->(x) { x }.freeze
31
29
 
32
30
  # A special value you can use as a default to know if no arguments
33
31
  # were passed to the method
@@ -40,7 +38,7 @@ module Dry
40
38
  # puts value
41
39
  # end
42
40
  # end
43
- Undefined = Object.new.tap do |undefined|
41
+ Undefined = ::Object.new.tap do |undefined|
44
42
  # @api private
45
43
  Self = -> { Undefined } # rubocop:disable Lint/ConstantDefinitionInBlock
46
44
 
@@ -8,6 +8,8 @@ module Dry
8
8
  # @api abstract
9
9
  #
10
10
  class Item
11
+ NO_OPTIONS = {}.freeze
12
+
11
13
  # @return [Mixed] the item to be solved later
12
14
  attr_reader :item
13
15
 
@@ -15,16 +17,17 @@ module Dry
15
17
  attr_reader :options
16
18
 
17
19
  # @api abstract
18
- def initialize(item, options = {})
20
+ def initialize(item, options = NO_OPTIONS)
19
21
  @item = item
20
22
  @options = {
21
- call: item.is_a?(::Proc) && item.parameters.empty?
22
- }.merge(options)
23
+ call: item.is_a?(::Proc) && item.parameters.empty?,
24
+ **options
25
+ }
23
26
  end
24
27
 
25
28
  # @api abstract
26
29
  def call
27
- raise NotImplementedError
30
+ raise ::NotImplementedError
28
31
  end
29
32
 
30
33
  # @private
@@ -6,18 +6,18 @@ require "dry/core/constants"
6
6
  module Dry
7
7
  module Core
8
8
  class Container
9
- include Dry::Core::Constants
9
+ include ::Dry::Core::Constants
10
10
 
11
11
  # @api public
12
- Error = Class.new(StandardError)
12
+ Error = ::Class.new(::StandardError)
13
13
 
14
14
  # Error raised when key is not defined in the registry
15
15
  #
16
16
  # @api public
17
- KeyError = Class.new(::KeyError)
17
+ KeyError = ::Class.new(::KeyError)
18
18
 
19
- if defined?(DidYouMean::KeyErrorChecker)
20
- DidYouMean.correct_error(KeyError, DidYouMean::KeyErrorChecker)
19
+ if defined?(::DidYouMean::KeyErrorChecker)
20
+ ::DidYouMean.correct_error(KeyError, ::DidYouMean::KeyErrorChecker)
21
21
  end
22
22
 
23
23
  # Mixin to expose Inversion of Control (IoC) container behaviour
@@ -68,7 +68,7 @@ module Dry
68
68
 
69
69
  # @private
70
70
  module Initializer
71
- def initialize(*args, &block)
71
+ def initialize(...)
72
72
  @_container = ::Concurrent::Hash.new
73
73
  super
74
74
  end
@@ -112,8 +112,8 @@ module Dry
112
112
  config.registry.call(_container, key, item, options)
113
113
 
114
114
  self
115
- rescue FrozenError
116
- raise FrozenError,
115
+ rescue ::FrozenError
116
+ raise ::FrozenError,
117
117
  "can't modify frozen #{self.class} (when attempting to register '#{key}')"
118
118
  end
119
119
 
@@ -128,8 +128,8 @@ module Dry
128
128
  # @return [Mixed]
129
129
  #
130
130
  # @api public
131
- def resolve(key, &block)
132
- config.resolver.call(_container, key, &block)
131
+ def resolve(key, &)
132
+ config.resolver.call(_container, key, &)
133
133
  end
134
134
 
135
135
  # Resolve an item from the container
@@ -198,8 +198,8 @@ module Dry
198
198
  # @return [Dry::Core::Container::Mixin] self
199
199
  #
200
200
  # @api public
201
- def each_key(&block)
202
- config.resolver.each_key(_container, &block)
201
+ def each_key(&)
202
+ config.resolver.each_key(_container, &)
203
203
  self
204
204
  end
205
205
 
@@ -215,8 +215,8 @@ module Dry
215
215
  # @note In discussions with other developers, it was felt that being able to iterate
216
216
  # over not just the registered keys, but to see what was registered would be
217
217
  # very helpful. This is a step toward doing that.
218
- def each(&block)
219
- config.resolver.each(_container, &block)
218
+ def each(&)
219
+ config.resolver.each(_container, &)
220
220
  end
221
221
 
222
222
  # Decorates an item from the container with specified decorator
@@ -250,12 +250,12 @@ module Dry
250
250
  # @return [Dry::Core::Container::Mixin] self
251
251
  #
252
252
  # @api public
253
- def namespace(namespace, &block)
253
+ def namespace(namespace, &)
254
254
  ::Dry::Core::Container::NamespaceDSL.new(
255
255
  self,
256
256
  namespace,
257
257
  config.namespace_separator,
258
- &block
258
+ &
259
259
  )
260
260
 
261
261
  self
@@ -34,12 +34,12 @@ module Dry
34
34
  end
35
35
  end
36
36
 
37
- def register(key, *args, &block)
38
- super(namespaced(key), *args, &block)
37
+ def register(key, ...)
38
+ super(namespaced(key), ...)
39
39
  end
40
40
 
41
- def namespace(namespace, &block)
42
- super(namespaced(namespace), &block)
41
+ def namespace(namespace, &)
42
+ super(namespaced(namespace), &)
43
43
  end
44
44
 
45
45
  def import(namespace)
@@ -66,8 +66,8 @@ module Dry
66
66
  # @return Hash
67
67
  #
68
68
  # @api public
69
- def each_key(container, &block)
70
- container.each_key(&block)
69
+ def each_key(container, &)
70
+ container.each_key(&)
71
71
  end
72
72
 
73
73
  # Calls block once for each key in container, passing the key and
@@ -81,8 +81,8 @@ module Dry
81
81
  # @note In discussions with other developers, it was felt that being able
82
82
  # to iterate over not just the registered keys, but to see what was
83
83
  # registered would be very helpful. This is a step toward doing that.
84
- def each(container, &block)
85
- container.map { |key, value| [key, value.call] }.each(&block)
84
+ def each(container, &)
85
+ container.map { |key, value| [key, value.call] }.each(&)
86
86
  end
87
87
  end
88
88
  end
@@ -14,7 +14,7 @@ module Dry
14
14
  # Add a stub to the container
15
15
  def stub(key, value, &block)
16
16
  unless key?(key)
17
- raise ArgumentError, "cannot stub #{key.to_s.inspect} - no such key in container"
17
+ raise ::ArgumentError, "cannot stub #{key.to_s.inspect} - no such key in container"
18
18
  end
19
19
 
20
20
  _stubs[key.to_s] = value
@@ -106,7 +106,7 @@ module Dry
106
106
  if output.respond_to?(:warn)
107
107
  @logger = output
108
108
  else
109
- @logger = Logger.new(output).tap do |logger|
109
+ @logger = ::Logger.new(output).tap do |logger|
110
110
  logger.formatter = proc { |_, _, _, msg| "#{msg}\n" }
111
111
  end
112
112
  end
@@ -218,7 +218,7 @@ module Dry
218
218
  message
219
219
  )
220
220
 
221
- mod = Module.new do
221
+ mod = ::Module.new do
222
222
  define_method(:const_missing) do |missing|
223
223
  if missing == constant_name
224
224
  warn("#{full_msg}\n#{STACK.()}")
@@ -30,7 +30,7 @@ module Dry
30
30
  class << self
31
31
  # @api private
32
32
  def setup(target)
33
- target.instance_variable_set(:@descendants, Concurrent::Array.new)
33
+ target.instance_variable_set(:@descendants, ::Concurrent::Array.new)
34
34
  end
35
35
 
36
36
  private
@@ -150,7 +150,7 @@ module Dry
150
150
  #
151
151
  # @api public
152
152
  def self.Equalizer(*keys, **options)
153
- Dry::Core::Equalizer.new(*keys, **options)
153
+ ::Dry::Core::Equalizer.new(*keys, **options)
154
154
  end
155
155
  end
156
156
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Dry
4
4
  module Core
5
- class InvalidClassAttributeValueError < StandardError
5
+ class InvalidClassAttributeValueError < ::StandardError
6
6
  def initialize(name, value)
7
7
  super(
8
8
  "Value #{value.inspect} is invalid for class attribute #{name.inspect}"
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "set"
4
-
5
3
  module Dry
6
4
  module Core
7
5
  # Define extensions that can be later enabled by the user.
@@ -25,7 +23,7 @@ module Dry
25
23
  def self.extended(obj)
26
24
  super
27
25
  obj.instance_variable_set(:@__available_extensions__, {})
28
- obj.instance_variable_set(:@__loaded_extensions__, Set.new)
26
+ obj.instance_variable_set(:@__loaded_extensions__, ::Set.new)
29
27
  end
30
28
 
31
29
  # Register an extension
@@ -50,7 +48,7 @@ module Dry
50
48
  def load_extensions(*extensions)
51
49
  extensions.each do |ext|
52
50
  block = @__available_extensions__.fetch(ext) do
53
- raise ArgumentError, "Unknown extension: #{ext.inspect}"
51
+ raise ::ArgumentError, "Unknown extension: #{ext.inspect}"
54
52
  end
55
53
  unless @__loaded_extensions__.include?(ext)
56
54
  block.call
@@ -12,7 +12,7 @@ module Dry
12
12
  ],
13
13
  dry_inflector: [
14
14
  "dry/inflector",
15
- proc { Dry::Inflector.new }
15
+ proc { ::Dry::Inflector.new }
16
16
  ],
17
17
  inflecto: [
18
18
  "inflecto",
@@ -25,7 +25,7 @@ module Dry
25
25
  # @api private
26
26
  def self.realize_backend(path, backend_factory)
27
27
  require path
28
- rescue LoadError
28
+ rescue ::LoadError
29
29
  nil
30
30
  else
31
31
  backend_factory.call
@@ -37,9 +37,11 @@ module Dry
37
37
  def self.detect_backend
38
38
  BACKENDS.inject(nil) do |backend, (_, (path, factory))|
39
39
  backend || realize_backend(path, factory)
40
- end || raise(LoadError,
41
- "No inflector library could be found: "\
42
- "please install either the `inflecto` or `activesupport` gem.")
40
+ end || raise(
41
+ LoadError,
42
+ "No inflector library could be found: " \
43
+ "please install either the `inflecto` or `activesupport` gem."
44
+ )
43
45
  end
44
46
 
45
47
  # Set preferred backend
@@ -47,7 +49,7 @@ module Dry
47
49
  # @param [Symbol] name backend name (:activesupport or :inflecto)
48
50
  def self.select_backend(name = nil)
49
51
  if name && !BACKENDS.key?(name)
50
- raise NameError, "Invalid inflector library selection: '#{name}'"
52
+ raise ::NameError, "Invalid inflector library selection: '#{name}'"
51
53
  end
52
54
 
53
55
  @inflector = name ? realize_backend(*BACKENDS[name]) : detect_backend
@@ -23,7 +23,7 @@ module Dry
23
23
  module BasicObject
24
24
  include Base
25
25
 
26
- def new(*)
26
+ def new(*, **)
27
27
  obj = super
28
28
  obj.instance_eval { @__memoized__ = MEMOIZED_HASH.dup }
29
29
  obj
@@ -33,15 +33,11 @@ module Dry
33
33
  module Object
34
34
  include Base
35
35
 
36
- def new(*)
36
+ def new(*, **)
37
37
  obj = super
38
38
  obj.instance_variable_set(:@__memoized__, MEMOIZED_HASH.dup)
39
39
  obj
40
40
  end
41
-
42
- if respond_to?(:ruby2_keywords, true)
43
- ruby2_keywords(:new)
44
- end
45
41
  end
46
42
  end
47
43
 
@@ -77,14 +73,13 @@ module Dry
77
73
 
78
74
  # @api private
79
75
  # rubocop:disable Metrics/AbcSize
80
- # rubocop:disable Metrics/PerceivedComplexity
81
76
  def define_memoizable(method:)
82
77
  parameters = method.parameters
83
78
  mod = self
84
79
  kernel = KERNEL
85
80
 
86
81
  if parameters.empty?
87
- key = "#{object_id}:#{method.name}".hash.abs
82
+ key = "#{__id__}:#{method.name}".hash.abs
88
83
 
89
84
  define_method(method.name) do
90
85
  value = super()
@@ -134,7 +129,7 @@ module Dry
134
129
  WARN
135
130
  end
136
131
 
137
- m = module_eval(<<~RUBY, __FILE__, __LINE__ + 1)
132
+ module_eval(<<~RUBY, __FILE__, __LINE__ + 1)
138
133
  def #{method.name}(#{params.join(", ")}) # def slow_calc(arg1, arg2, arg3)
139
134
  key = [:"#{method.name}", #{binds.join(", ")}].hash # key = [:slow_calc, arg1, arg2, arg3].hash
140
135
  #
@@ -146,16 +141,10 @@ module Dry
146
141
  end # end
147
142
  RUBY
148
143
 
149
- if respond_to?(:ruby2_keywords, true) && mapping.key?(:reyrest)
150
- ruby2_keywords(method.name)
151
- end
152
-
153
- m
154
144
  end
155
145
  end
156
- # rubocop:enable Metrics/AbcSize
157
- # rubocop:enable Metrics/PerceivedComplexity
158
146
 
147
+ # rubocop:enable Metrics/AbcSize
159
148
  # @api private
160
149
  def declaration(definition, lookup)
161
150
  params = []
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Core
5
- VERSION = "1.0.2"
5
+ VERSION = "1.2.0"
6
6
  end
7
7
  end
data/lib/dry/core.rb CHANGED
@@ -13,10 +13,10 @@ module Dry
13
13
  include Constants
14
14
 
15
15
  def self.loader
16
- @loader ||= Zeitwerk::Loader.new.tap do |loader|
17
- root = File.expand_path("..", __dir__)
16
+ @loader ||= ::Zeitwerk::Loader.new.tap do |loader|
17
+ root = ::File.expand_path("..", __dir__)
18
18
  loader.tag = "dry-core"
19
- loader.inflector = Zeitwerk::GemInflector.new("#{root}/dry-core.rb")
19
+ loader.inflector = ::Zeitwerk::GemInflector.new("#{root}/dry-core.rb")
20
20
  loader.push_dir(root)
21
21
  loader.ignore(
22
22
  "#{root}/dry-core.rb",
@@ -50,7 +50,7 @@ module Dry
50
50
  #
51
51
  # @api public
52
52
  def self.Equalizer(*keys, **options)
53
- Dry::Core::Equalizer.new(*keys, **options)
53
+ ::Dry::Core::Equalizer.new(*keys, **options)
54
54
  end
55
55
  end
56
56
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
- - Nikita Shilnikov
8
- autorequire:
7
+ - Hanakai team
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-29 00:00:00.000000000 Z
11
+ date: 2025-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -96,10 +96,13 @@ dependencies:
96
96
  version: '0'
97
97
  description: A toolset of small support modules used throughout the dry-rb ecosystem
98
98
  email:
99
- - fg@flashgordon.ru
99
+ - info@hanakai.org
100
100
  executables: []
101
101
  extensions: []
102
- extra_rdoc_files: []
102
+ extra_rdoc_files:
103
+ - README.md
104
+ - CHANGELOG.md
105
+ - LICENSE
103
106
  files:
104
107
  - CHANGELOG.md
105
108
  - LICENSE
@@ -141,7 +144,8 @@ metadata:
141
144
  changelog_uri: https://github.com/dry-rb/dry-core/blob/main/CHANGELOG.md
142
145
  source_code_uri: https://github.com/dry-rb/dry-core
143
146
  bug_tracker_uri: https://github.com/dry-rb/dry-core/issues
144
- post_install_message:
147
+ funding_uri: https://github.com/sponsors/hanami
148
+ post_install_message:
145
149
  rdoc_options: []
146
150
  require_paths:
147
151
  - lib
@@ -149,7 +153,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
149
153
  requirements:
150
154
  - - ">="
151
155
  - !ruby/object:Gem::Version
152
- version: 3.0.0
156
+ version: '3.2'
153
157
  required_rubygems_version: !ruby/object:Gem::Requirement
154
158
  requirements:
155
159
  - - ">="
@@ -157,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
161
  version: '0'
158
162
  requirements: []
159
163
  rubygems_version: 3.3.27
160
- signing_key:
164
+ signing_key:
161
165
  specification_version: 4
162
166
  summary: A toolset of small support modules used throughout the dry-rb ecosystem
163
167
  test_files: []