dry-monads 1.9.0 → 1.10.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: d622cbb5031bf37a7fa463737b02249525b347f8bf775586607dd8bf7229c1c3
4
- data.tar.gz: da9d5de9434d5eebc18f83d501f718b348889bfa92cc0b5a991ab68c0223684e
3
+ metadata.gz: 527c622566bcbf2acd219b357314a4b6388f49ef9f4dcfd775298de921629c7b
4
+ data.tar.gz: 3dc196066bd360620f39a550575a52b4d112849e09484ad76eb565002611950c
5
5
  SHA512:
6
- metadata.gz: 0e90960ceb2c111c424578e61daa1f0cde79bd52869e7545915e9d4d6208407820b3609f258da5dcf8be473ed8534056245d37a7d349de0934cec724077c3f54
7
- data.tar.gz: 6653a465bca76cd3606a8135f03f6208062f73df42ff51164847ea15f5ed2e9a5afb9cd00665650d9b928163800d997947cc3c5ee5556f11759a229e373e573f
6
+ metadata.gz: 5dc4be9b41c1f2349b8078831d0d8980e89095da3b09cbf0084d392ce0966fcf4575d4ffa811deecf894eeb4c16cea1d09d97ebd2ef6458c6e18864f0adc42b6
7
+ data.tar.gz: 587c40965ce23128508b1978d2e5e2d55aff7d3780f777d6a45fbff58d19165809d8a143871269b6092ef475b4b769fcfa262414693bd9b716435ec45c4b0915
data/CHANGELOG.md CHANGED
@@ -1,51 +1,75 @@
1
- <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
1
+ # Changelog
2
2
 
3
- ## 1.9.0 2025-06-24
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]
5
9
 
6
10
  ### Added
7
11
 
8
- - Add `pretty_print` extension for improved output (@paul + @flash-gordon in #189 and #190)
12
+ ### Changed
13
+
14
+ ### Deprecated
15
+
16
+ ### Removed
9
17
 
10
18
  ### Fixed
11
19
 
12
- - Fix nested modules not being extended in RSpec (@flash-gordon)
20
+ ### Security
13
21
 
22
+ [Unreleased]: https://github.com/dry-rb/dry-monads/compare/v1.10.0...main
14
23
 
15
- [Compare v1.8.3...v1.9.0](https://github.com/dry-rb/dry-monads/compare/v1.8.3...v1.9.0)
24
+ ## [1.10.0] - 2026-04-24
16
25
 
17
- ## 1.8.3 2025-04-04
26
+ ### Added
18
27
 
28
+ - Support for JRuby (via fixes to RSpec extension). (@katafrakt in #200 & #201, @flash-gordon in c6967b6)
19
29
 
20
30
  ### Fixed
21
31
 
22
- - Fix signature of warning filter (@flash-gordon, issue #187)
32
+ - Fix param names and Ruby syntax in API doc examples. (@mensfeld in #196)
23
33
 
34
+ [1.10.0]: https://github.com/dry-rb/dry-monads/compare/v1.9.0...v1.10.0
24
35
 
25
- [Compare v1.8.2...v1.8.3](https://github.com/dry-rb/dry-monads/compare/v1.8.2...v1.8.3)
36
+ ## [1.9.0] - 2025-06-24
26
37
 
27
- ## 1.8.2 2025-03-15
38
+ ### Added
28
39
 
40
+ - Add `pretty_print` extension for improved output (@paul + @flash-gordon in #189 and #190)
29
41
 
30
42
  ### Fixed
31
43
 
32
- - Fix be_* matchers for non-monadic values (@flash-gordon, issue #186)
44
+ - Fix nested modules not being extended in RSpec (@flash-gordon)
33
45
 
46
+ [1.9.0]: https://github.com/dry-rb/dry-monads/compare/v1.8.3...v1.9.0
34
47
 
35
- [Compare v1.8.1...v1.8.2](https://github.com/dry-rb/dry-monads/compare/v1.8.1...v1.8.2)
48
+ ## [1.8.3] - 2025-04-04
49
+
50
+ ### Fixed
51
+
52
+ - Fix signature of warning filter (@flash-gordon, issue #187)
36
53
 
37
- ## 1.8.1 2025-03-12
54
+ [1.8.3]: https://github.com/dry-rb/dry-monads/compare/v1.8.2...v1.8.3
38
55
 
56
+ ## [1.8.2] - 2025-03-15
39
57
 
40
58
  ### Fixed
41
59
 
42
- - Exclude extensions from the Zeitwerk loader (@flash-gordon, issue #185)
60
+ - Fix be_* matchers for non-monadic values (@flash-gordon, issue #186)
61
+
62
+ [1.8.2]: https://github.com/dry-rb/dry-monads/compare/v1.8.1...v1.8.2
63
+
64
+ ## [1.8.1] - 2025-03-12
43
65
 
66
+ ### Fixed
44
67
 
45
- [Compare v1.8.0...v1.8.1](https://github.com/dry-rb/dry-monads/compare/v1.8.0...v1.8.1)
68
+ - Exclude extensions from the Zeitwerk loader (@flash-gordon, issue #185)
46
69
 
47
- ## 1.8.0 2025-03-12
70
+ [1.8.1]: https://github.com/dry-rb/dry-monads/compare/v1.8.0...v1.8.1
48
71
 
72
+ ## [1.8.0] - 2025-03-12
49
73
 
50
74
  ### Added
51
75
 
@@ -141,21 +165,17 @@
141
165
  )
142
166
  ```
143
167
 
168
+ [1.8.0]: https://github.com/dry-rb/dry-monads/compare/v1.7.1...v1.8.0
144
169
 
145
- [Compare v1.7.1...v1.8.0](https://github.com/dry-rb/dry-monads/compare/v1.7.1...v1.8.0)
146
-
147
- ## 1.7.1 2025-01-21
148
-
170
+ ## [1.7.1] - 2025-01-21
149
171
 
150
172
  ### Fixed
151
173
 
152
174
  - Fix warnings about unused block arguments (@flash-gordon)
153
175
 
176
+ [1.7.1]: https://github.com/dry-rb/dry-monads/compare/v1.7.0...v1.7.1
154
177
 
155
- [Compare v1.7.0...v1.7.1](https://github.com/dry-rb/dry-monads/compare/v1.7.0...v1.7.1)
156
-
157
- ## 1.7.0 2025-01-07
158
-
178
+ ## [1.7.0] - 2025-01-07
159
179
 
160
180
  ### Fixed
161
181
 
@@ -165,19 +185,17 @@
165
185
 
166
186
  - Set 3.1 as minimum Ruby version (@flash-gordon)
167
187
 
168
- [Compare v1.6.0...v1.7.0](https://github.com/dry-rb/dry-monads/compare/v1.6.0...v1.7.0)
169
-
170
- ## 1.6.0 2022-11-04
188
+ [1.7.0]: https://github.com/dry-rb/dry-monads/compare/v1.6.0...v1.7.0
171
189
 
190
+ ## [1.6.0] - 2022-11-04
172
191
 
173
192
  ### Changed
174
193
 
175
194
  - This version uses dry-core 1.0 (@flash-gordon)
176
195
 
177
- [Compare v1.5.0...v1.6.0](https://github.com/dry-rb/dry-monads/compare/v1.5.0...v1.6.0)
178
-
179
- ## 1.5.0 2022-10-16
196
+ [1.6.0]: https://github.com/dry-rb/dry-monads/compare/v1.5.0...v1.6.0
180
197
 
198
+ ## [1.5.0] - 2022-10-16
181
199
 
182
200
  ### Changed
183
201
 
@@ -186,10 +204,9 @@
186
204
  - Minimal Ruby version is now 2.7 (@flash-gordon)
187
205
  - Either (old name of Result) was removed (@flash-gordon)
188
206
 
189
- [Compare v1.4.0...v1.5.0](https://github.com/dry-rb/dry-monads/compare/v1.4.0...v1.5.0)
190
-
191
- ## 1.4.0 2021-07-20
207
+ [1.5.0]: https://github.com/dry-rb/dry-monads/compare/v1.4.0...v1.5.0
192
208
 
209
+ ## [1.4.0] - 2021-07-20
193
210
 
194
211
  ### Added
195
212
 
@@ -238,40 +255,33 @@ This behavior will be dropped in 2.0 but you can opt out of warnings for the tim
238
255
  ```
239
256
  - Minimal Ruby version is 2.6
240
257
 
241
- [Compare v1.3.5...v1.4.0](https://github.com/dry-rb/dry-monads/compare/v1.3.5...v1.4.0)
242
-
243
- ## 1.3.5 2020-01-06
258
+ [1.4.0]: https://github.com/dry-rb/dry-monads/compare/v1.3.5...v1.4.0
244
259
 
260
+ ## [1.3.5] - 2020-01-06
245
261
 
246
262
  ### Added
247
263
 
248
264
  - Smarter keys deconstruction in pattern matching (flash-gordon)
249
265
 
266
+ [1.3.5]: https://github.com/dry-rb/dry-monads/compare/v1.3.4...v1.3.5
250
267
 
251
- [Compare v1.3.4...v1.3.5](https://github.com/dry-rb/dry-monads/compare/v1.3.4...v1.3.5)
252
-
253
- ## 1.3.4 2019-12-28
254
-
268
+ ## [1.3.4] - 2019-12-28
255
269
 
256
270
  ### Fixed
257
271
 
258
272
  - One more delegation warning happenning in do notation (flash-gordon)
259
273
 
274
+ [1.3.4]: https://github.com/dry-rb/dry-monads/compare/v1.3.3...v1.3.4
260
275
 
261
- [Compare v1.3.3...v1.3.4](https://github.com/dry-rb/dry-monads/compare/v1.3.3...v1.3.4)
262
-
263
- ## 1.3.3 2019-12-11
264
-
276
+ ## [1.3.3] - 2019-12-11
265
277
 
266
278
  ### Fixed
267
279
 
268
280
  - Incompatibility with Rails. Internal (!) halt exceptions now use mutable backtraces because spring [mutates](https://github.com/rails/spring/blob/ee687859008e947bc905b95121e306e2948d31c9/lib/spring/application.rb#L295-L311) (!) them. For the record, this a bug in Rails (johnmaxwell)
269
281
 
282
+ [1.3.3]: https://github.com/dry-rb/dry-monads/compare/v1.3.2...v1.3.3
270
283
 
271
- [Compare v1.3.2...v1.3.3](https://github.com/dry-rb/dry-monads/compare/v1.3.2...v1.3.3)
272
-
273
- ## 1.3.2 2019-11-30
274
-
284
+ ## [1.3.2] - 2019-11-30
275
285
 
276
286
  ### Added
277
287
 
@@ -288,21 +298,17 @@ This behavior will be dropped in 2.0 but you can opt out of warnings for the tim
288
298
 
289
299
  - Warnings about keywords from Ruby 2.7 (flash-gordon)
290
300
 
301
+ [1.3.2]: https://github.com/dry-rb/dry-monads/compare/v1.3.1...v1.3.2
291
302
 
292
- [Compare v1.3.1...v1.3.2](https://github.com/dry-rb/dry-monads/compare/v1.3.1...v1.3.2)
293
-
294
- ## 1.3.1 2019-09-07
295
-
303
+ ## [1.3.1] - 2019-09-07
296
304
 
297
305
  ### Fixed
298
306
 
299
307
  - Added missing `None#maybe` :sweat_smile: (flash-gordon)
300
308
 
309
+ [1.3.1]: https://github.com/dry-rb/dry-monads/compare/v1.3.0...v1.3.1
301
310
 
302
- [Compare v1.3.0...v1.3.1](https://github.com/dry-rb/dry-monads/compare/v1.3.0...v1.3.1)
303
-
304
- ## 1.3.0 2019-08-03
305
-
311
+ ## [1.3.0] - 2019-08-03
306
312
 
307
313
  ### Added
308
314
 
@@ -385,11 +391,9 @@ This behavior will be dropped in 2.0 but you can opt out of warnings for the tim
385
391
 
386
392
  Keep in mind this feature is experimental and can be changed by 2.7 release. But it rocks already!
387
393
 
394
+ [1.3.0]: https://github.com/dry-rb/dry-monads/compare/v1.2.0...v1.3.0
388
395
 
389
- [Compare v1.2.0...v1.3.0](https://github.com/dry-rb/dry-monads/compare/v1.2.0...v1.3.0)
390
-
391
- ## 1.2.0 2019-01-12
392
-
396
+ ## [1.2.0] - 2019-01-12
393
397
 
394
398
  ### Added
395
399
 
@@ -477,11 +481,9 @@ This behavior will be dropped in 2.0 but you can opt out of warnings for the tim
477
481
  ```
478
482
  - `Task.failed` is a counterpart of `Task.pure`, accepts an exception and returns a failed task immediately (flash-gordon)
479
483
 
484
+ [1.2.0]: https://github.com/dry-rb/dry-monads/compare/v1.1.0...v1.2.0
480
485
 
481
- [Compare v1.1.0...v1.2.0](https://github.com/dry-rb/dry-monads/compare/v1.1.0...v1.2.0)
482
-
483
- ## 1.1.0 2018-10-16
484
-
486
+ ## [1.1.0] - 2018-10-16
485
487
 
486
488
  ### Added
487
489
 
@@ -503,11 +505,9 @@ This behavior will be dropped in 2.0 but you can opt out of warnings for the tim
503
505
 
504
506
  - Do notation was made to work nicely with inheritance. This shouldn't break any existing code but if it does please report (flash-gordon)
505
507
 
508
+ [1.1.0]: https://github.com/dry-rb/dry-monads/compare/v1.0.1...v1.1.0
506
509
 
507
- [Compare v1.0.1...v1.1.0](https://github.com/dry-rb/dry-monads/compare/v1.0.1...v1.1.0)
508
-
509
- ## 1.0.1 2018-08-11
510
-
510
+ ## [1.0.1] - 2018-08-11
511
511
 
512
512
  ### Added
513
513
 
@@ -520,11 +520,9 @@ This behavior will be dropped in 2.0 but you can opt out of warnings for the tim
520
520
 
521
521
  - Fixed behavior of `List<Validated>#traverse` in presence of `Valid` values (flash-gordon + SunnyMagadan)
522
522
 
523
+ [1.0.1]: https://github.com/dry-rb/dry-monads/compare/v1.0.0...v1.0.1
523
524
 
524
- [Compare v1.0.0...v1.0.1](https://github.com/dry-rb/dry-monads/compare/v1.0.0...v1.0.1)
525
-
526
- ## 1.0.0 2018-06-26
527
-
525
+ ## [1.0.0] - 2018-06-26
528
526
 
529
527
  ### Added
530
528
 
@@ -662,11 +660,9 @@ This behavior will be dropped in 2.0 but you can opt out of warnings for the tim
662
660
  - `Either#value` and `Maybe#value` were both droped, use `value_or` or `value!` when you :100: sure it's safe
663
661
  - `require 'dry/monads'` doesn't load all monads anymore, use `require 'dry/monads/all'` instead or cherry pick them with `require 'dry/monads/maybe'` etc (timriley)
664
662
 
663
+ [1.0.0]: https://github.com/dry-rb/dry-monads/compare/v0.4.0...v1.0.0
665
664
 
666
- [Compare v0.4.0...v1.0.0](https://github.com/dry-rb/dry-monads/compare/v0.4.0...v1.0.0)
667
-
668
- ## 0.4.0 2017-11-11
669
-
665
+ ## [0.4.0] - 2017-11-11
670
666
 
671
667
  ### Added
672
668
 
@@ -691,20 +687,17 @@ This behavior will be dropped in 2.0 but you can opt out of warnings for the tim
691
687
  - The `Either` monad was renamed to `Result` which sounds less nerdy but better reflects the purpose of the type. `Either::Right` became `Result::Success` and `Either::Left` became `Result::Failure`. This change is backward-compatible overall but you will see the new names when using old `Left` and `Right` methods (citizen428)
692
688
  - Consequently, `Try::Success` and `Try::Failure` were renamed to `Try::Value` and `Try::Error` (flash-gordon)
693
689
 
694
- [Compare v0.3.1...v0.4.0](https://github.com/dry-rb/dry-monads/compare/v0.3.1...v0.4.0)
695
-
696
- ## 0.3.1 2017-03-18
690
+ [0.4.0]: https://github.com/dry-rb/dry-monads/compare/v0.3.1...v0.4.0
697
691
 
692
+ ## [0.3.1] - 2017-03-18
698
693
 
699
694
  ### Fixed
700
695
 
701
696
  - Fixed unexpected coercing to `Hash` on `.bind` call (flash-gordon)
702
697
 
698
+ [0.3.1]: https://github.com/dry-rb/dry-monads/compare/v0.3.0...v0.3.1
703
699
 
704
- [Compare v0.3.0...v0.3.1](https://github.com/dry-rb/dry-monads/compare/v0.3.0...v0.3.1)
705
-
706
- ## 0.3.0 2017-03-16
707
-
700
+ ## [0.3.0] - 2017-03-16
708
701
 
709
702
  ### Added
710
703
 
@@ -716,11 +709,9 @@ This behavior will be dropped in 2.0 but you can opt out of warnings for the tim
716
709
  - Added `List#traverse` that "flips" the list with an embedded monad (flash-gordon + damncabbage)
717
710
  - Added `#tee` for all right-biased monads (flash-gordon)
718
711
 
712
+ [0.3.0]: https://github.com/dry-rb/dry-monads/compare/v0.2.1...v0.3.0
719
713
 
720
- [Compare v0.2.1...v0.3.0](https://github.com/dry-rb/dry-monads/compare/v0.2.1...v0.3.0)
721
-
722
- ## 0.2.1 2016-11-13
723
-
714
+ ## [0.2.1] - 2016-11-13
724
715
 
725
716
  ### Added
726
717
 
@@ -731,32 +722,26 @@ This behavior will be dropped in 2.0 but you can opt out of warnings for the tim
731
722
  - `Right(nil).to_maybe` now returns `None` with a warning instead of failing (orisaka)
732
723
  - `Some#value_or` doesn't require an argument because `None#value_or` doesn't require it either if a block was passed (flash-gordon)
733
724
 
725
+ [0.2.1]: https://github.com/dry-rb/dry-monads/compare/v0.2.0...v0.2.1
734
726
 
735
- [Compare v0.2.0...v0.2.1](https://github.com/dry-rb/dry-monads/compare/v0.2.0...v0.2.1)
736
-
737
- ## 0.2.0 2016-09-18
738
-
727
+ ## [0.2.0] - 2016-09-18
739
728
 
740
729
  ### Added
741
730
 
742
731
  - Added `Maybe#to_json` as an opt-in extension for serialization to JSON (rocknruby)
743
732
  - Added `Maybe#value_or` which returns you the underlying value with a fallback in a single method call (dsounded)
744
733
 
734
+ [0.2.0]: https://github.com/dry-rb/dry-monads/compare/v0.1.1...v0.2.0
745
735
 
746
- [Compare v0.1.1...v0.2.0](https://github.com/dry-rb/dry-monads/compare/v0.1.1...v0.2.0)
747
-
748
- ## 0.1.1 2016-08-25
749
-
736
+ ## [0.1.1] - 2016-08-25
750
737
 
751
738
  ### Fixed
752
739
 
753
740
  - Added explicit requires of `dry-equalizer`. This allows to safely load only specific monads (artofhuman)
754
741
 
742
+ [0.1.1]: https://github.com/dry-rb/dry-monads/compare/v0.1.0...v0.1.1
755
743
 
756
- [Compare v0.1.0...v0.1.1](https://github.com/dry-rb/dry-monads/compare/v0.1.0...v0.1.1)
757
-
758
- ## 0.1.0 2016-08-23
759
-
744
+ ## [0.1.0] - 2016-08-23
760
745
 
761
746
  ### Added
762
747
 
@@ -766,19 +751,17 @@ This behavior will be dropped in 2.0 but you can opt out of warnings for the tim
766
751
 
767
752
  - Dropped MRI 2.0 support (flash-gordon)
768
753
 
769
- [Compare v0.0.2...v0.1.0](https://github.com/dry-rb/dry-monads/compare/v0.0.2...v0.1.0)
770
-
771
- ## 0.0.2 2016-06-29
754
+ [0.1.0]: https://github.com/dry-rb/dry-monads/compare/v0.0.2...v0.1.0
772
755
 
756
+ ## [0.0.2] - 2016-06-29
773
757
 
774
758
  ### Added
775
759
 
776
760
  - Added `Either#to_either` so that you can rely on duck-typing when you work with different types of monads (timriley)
777
761
  - Added `Maybe#to_maybe` for consistency with `#to_either` (flash-gordon)
778
762
 
763
+ [0.0.2]: https://github.com/dry-rb/dry-monads/compare/v0.0.1...v0.0.2
779
764
 
780
- [Compare v0.0.1...v0.0.2](https://github.com/dry-rb/dry-monads/compare/v0.0.1...v0.0.2)
781
-
782
- ## 0.0.1 2016-05-02
765
+ ## [0.0.1] - 2016-05-02
783
766
 
784
767
  Initial release containing `Either`, `Maybe`, and `Try` monads.
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-2026 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
data/README.md CHANGED
@@ -1,22 +1,22 @@
1
- <!--- this file is synced from dry-rb/template-gem project -->
2
- [gem]: https://rubygems.org/gems/dry-monads
3
- [actions]: https://github.com/dry-rb/dry-monads/actions
4
-
5
- # dry-monads [![Gem Version](https://badge.fury.io/rb/dry-monads.svg)][gem] [![CI Status](https://github.com/dry-rb/dry-monads/workflows/CI/badge.svg)][actions]
1
+ <!--- This file is synced from hanakai-rb/repo-sync -->
6
2
 
7
- ## Links
3
+ [actions]: https://github.com/dry-rb/dry-monads/actions
4
+ [chat]: https://discord.gg/naQApPAsZB
5
+ [forum]: https://discourse.hanamirb.org
6
+ [rubygem]: https://rubygems.org/gems/dry-monads
8
7
 
9
- * [User documentation](https://dry-rb.org/gems/dry-monads)
10
- * [API documentation](http://rubydoc.info/gems/dry-monads)
11
- * [Forum](https://discourse.dry-rb.org)
8
+ # dry-monads [![Gem Version](https://badge.fury.io/rb/dry-monads.svg)][rubygem] [![CI Status](https://github.com/dry-rb/dry-monads/workflows/CI/badge.svg)][actions]
12
9
 
13
- ## Supported Ruby versions
10
+ [![Forum](https://img.shields.io/badge/Forum-dc360f?logo=discourse&logoColor=white)][forum]
11
+ [![Chat](https://img.shields.io/badge/Chat-717cf8?logo=discord&logoColor=white)][chat]
14
12
 
15
- This library officially supports the following Ruby versions:
13
+ ## Links
16
14
 
17
- * MRI `>= 3.1`
18
- * jruby `>= 9.4` (not tested on CI)
15
+ - [User documentation](https://dry-rb.org/gems/dry-monads)
16
+ - [API documentation](http://rubydoc.info/gems/dry-monads)
17
+ - [Forum](https://discourse.dry-rb.org)
19
18
 
20
19
  ## License
21
20
 
22
21
  See `LICENSE` file.
22
+
data/dry-monads.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/monads/version"
8
8
 
9
9
  Gem::Specification.new do |spec|
10
10
  spec.name = "dry-monads"
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::Monads::VERSION.dup
15
15
 
@@ -17,20 +17,25 @@ Gem::Specification.new do |spec|
17
17
  spec.description = spec.summary
18
18
  spec.homepage = "https://dry-rb.org/gems/dry-monads"
19
19
  spec.files = Dir["CHANGELOG.md", "LICENSE", "README.md", "dry-monads.gemspec", "lib/**/*"]
20
- spec.bindir = "bin"
21
- spec.executables = []
20
+ spec.bindir = "exe"
21
+ spec.executables = Dir["exe/*"].map { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
25
- spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-monads/blob/main/CHANGELOG.md"
26
- spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-monads"
27
- spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-monads/issues"
28
- spec.metadata["rubygems_mfa_required"] = "true"
24
+ spec.extra_rdoc_files = ["README.md", "CHANGELOG.md", "LICENSE"]
25
+
26
+ spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-monads/blob/main/CHANGELOG.md"
27
+ spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-monads"
28
+ spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-monads/issues"
29
+ spec.metadata["funding_uri"] = "https://github.com/sponsors/hanami"
29
30
 
30
31
  spec.required_ruby_version = ">= 3.1.0"
31
32
 
32
- # to update dependencies edit project.yml
33
- spec.add_dependency "concurrent-ruby", "~> 1.0"
34
- spec.add_dependency "dry-core", "~> 1.1"
35
- spec.add_dependency "zeitwerk", "~> 2.6"
33
+ spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
34
+ spec.add_runtime_dependency "dry-core", "~> 1.1"
35
+ spec.add_runtime_dependency "zeitwerk", "~> 2.6"
36
+ spec.add_development_dependency "bundler"
37
+ spec.add_development_dependency "debug_inspector"
38
+ spec.add_development_dependency "rake"
39
+ spec.add_development_dependency "rspec"
36
40
  end
41
+
@@ -38,8 +38,8 @@ module Dry
38
38
  # @api public
39
39
  def call
40
40
  yield
41
- rescue Halt => e
42
- e.result
41
+ rescue Halt => exception
42
+ exception.result
43
43
  end
44
44
 
45
45
  # @api public
data/lib/dry/monads/do.rb CHANGED
@@ -59,7 +59,7 @@ module Dry
59
59
  #
60
60
  # attr_reader :user_repo
61
61
  #
62
- # def initialize(:user_repo)
62
+ # def initialize(user_repo)
63
63
  # @user_repo = user_repo
64
64
  # end
65
65
  #
@@ -44,13 +44,14 @@ module Dry
44
44
  }.freeze
45
45
 
46
46
  PREDICATES.each do |name, args|
47
- args => { expected_classes:, extract_value: }
47
+ args => {expected_classes:, extract_value:}
48
48
  expected_constructors = expected_classes.map(&:name).map do |c|
49
49
  c.split("::").last
50
50
  end
51
51
 
52
- matcher :"be_#{name}" do |expected = Undefined|
52
+ matcher :"be_#{name}" do |*expected_args|
53
53
  predicate = "#{name}?"
54
+ expected = expected_args.fetch(0, Undefined)
54
55
 
55
56
  match do |actual|
56
57
  if expected_classes.any? { |klass| actual.is_a?(klass) }
@@ -159,6 +160,37 @@ module Dry
159
160
  ::Dry::Monads::List
160
161
  end
161
162
  end
163
+
164
+ def rspec_example_context?(location)
165
+ example_group_instance = ::RSpec.current_example&.example_group_instance
166
+ return false unless example_group_instance
167
+
168
+ spec_example_block?(location) || example_group_method?(example_group_instance, location)
169
+ end
170
+
171
+ private
172
+
173
+ def spec_example_block?(location)
174
+ location.path.end_with?("_spec.rb") && location.label.include?("block")
175
+ end
176
+
177
+ def example_group_method?(example_group_instance, location)
178
+ method_name = caller_method_name(location)
179
+ return false unless method_name
180
+
181
+ owner = example_group_instance.method(method_name).owner
182
+
183
+ ![::BasicObject, ::Kernel, ::Object].include?(owner)
184
+ rescue NameError
185
+ false
186
+ end
187
+
188
+ def caller_method_name(location)
189
+ label = location.label.to_s
190
+ return nil if label.include?("block")
191
+
192
+ label.split(/[.#]/).last&.to_sym
193
+ end
162
194
  end
163
195
  end
164
196
  end
@@ -185,7 +217,7 @@ catch_missing_const = Module.new do
185
217
  def const_missing(name)
186
218
  const_name = Dry::Monads::RSpec.resolve_constant_name(name)
187
219
 
188
- if const_name && caller_locations(1, 1).first.path.end_with?("_spec.rb")
220
+ if const_name && Dry::Monads::RSpec.rspec_example_context?(caller_locations(1, 1).first)
189
221
  Dry::Monads::RSpec.name_to_const(const_name)
190
222
  else
191
223
  super
@@ -331,9 +331,12 @@ module Dry
331
331
  #
332
332
  # @example
333
333
  # case List[1, 2, 3]
334
- # in List[1, 2, x] then ...
335
- # in List[Integer, _, _] then ...
336
- # in List[0..2, _, _] then ...
334
+ # in List[1, 2, x]
335
+ # x
336
+ # in List[Integer, _, _]
337
+ # # ...
338
+ # in List[0..2, _, _]
339
+ # # ...
337
340
  # end
338
341
  #
339
342
  # @api private
@@ -250,9 +250,12 @@ module Dry
250
250
  #
251
251
  # @example
252
252
  # case Some(:foo)
253
- # in Some(Integer) then ...
254
- # in Some(:bar) then ...
255
- # in None() then ...
253
+ # in Some(Integer)
254
+ # # ...
255
+ # in Some(:bar)
256
+ # # ...
257
+ # in None()
258
+ # # ...
256
259
  # end
257
260
  #
258
261
  # @api private
@@ -368,7 +368,7 @@ module Dry
368
368
  class Some < Maybe
369
369
  # Converts to Sucess(value!)
370
370
  #
371
- # @param fail [#call] Fallback value
371
+ # @param _fail [#call] Fallback value
372
372
  # @param block [Proc] Fallback block
373
373
  # @return [Success<Any>]
374
374
  def to_result(_fail = Unit, &) = Result::Success.new(@value)
@@ -176,9 +176,12 @@ module Dry
176
176
  #
177
177
  # @example
178
178
  # case Success(x)
179
- # in Success(Integer) then ...
180
- # in Success(2..100) then ...
181
- # in Success(2..200 => code) then ...
179
+ # in Success(Integer)
180
+ # # ...
181
+ # in Success(2..100)
182
+ # # ...
183
+ # in Success(2..200 => code)
184
+ # # ...
182
185
  # end
183
186
  #
184
187
  # @api private
@@ -322,10 +325,14 @@ module Dry
322
325
  #
323
326
  # @example
324
327
  # case Success(x)
325
- # in Success(Integer) then ...
326
- # in Success(2..100) then ...
327
- # in Success(2..200 => code) then ...
328
- # in Failure(_) then ...
328
+ # in Success(Integer)
329
+ # # ...
330
+ # in Success(2..100)
331
+ # # ...
332
+ # in Success(2..200 => code)
333
+ # # ...
334
+ # in Failure(_)
335
+ # # ...
329
336
  # end
330
337
  #
331
338
  # @api private
@@ -140,7 +140,7 @@ module Dry
140
140
  end
141
141
  alias_method :inspect, :to_s
142
142
 
143
- # Tranforms the error if the computation wasn't successful.
143
+ # Transforms the error if the computation wasn't successful.
144
144
  #
145
145
  # @param block [Proc]
146
146
  # @return [Task]
@@ -161,8 +161,8 @@ module Dry
161
161
  inner.execute
162
162
  inner.on_success { child.on_fulfill(_1) }
163
163
  inner.on_error { child.on_reject(_1) }
164
- rescue StandardError => e
165
- child.on_reject(e)
164
+ rescue StandardError => exception
165
+ child.on_reject(exception)
166
166
  end
167
167
  promise.on_success { child.on_fulfill(_1) }
168
168
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Dry
4
4
  module Monads
5
- # Advanced tranformations.
5
+ # Advanced transformations.
6
6
  module Transformer
7
7
  # Lifts a block/proc over the 2-level nested structure.
8
8
  # This is essentially fmap . fmap (. is the function composition
@@ -27,8 +27,8 @@ module Dry
27
27
  # @return [Try::Value, Try::Error]
28
28
  def run(exceptions, f)
29
29
  Value.new(exceptions, f.call)
30
- rescue *exceptions => e
31
- Error.new(e)
30
+ rescue *exceptions => exception
31
+ Error.new(exception)
32
32
  end
33
33
  deprecate :lift, :run
34
34
 
@@ -125,8 +125,8 @@ module Dry
125
125
  # @return [Object, Try::Error]
126
126
  def bind(...)
127
127
  super
128
- rescue *catchable => e
129
- Error.new(e)
128
+ rescue *catchable => exception
129
+ Error.new(exception)
130
130
  end
131
131
 
132
132
  # Does the same thing as #bind except it also wraps the value
@@ -143,8 +143,8 @@ module Dry
143
143
  # @return [Try::Value, Try::Error]
144
144
  def fmap(...)
145
145
  Value.new(catchable, bind_call(...))
146
- rescue *catchable => e
147
- Error.new(e)
146
+ rescue *catchable => exception
147
+ Error.new(exception)
148
148
  end
149
149
 
150
150
  # @return [String]
@@ -159,7 +159,7 @@ module Dry
159
159
 
160
160
  # Ignores values and returns self, see {Try::Error#recover}
161
161
  #
162
- # @param errors [Class] List of Exception subclasses
162
+ # @param _errors [Class] List of Exception subclasses
163
163
  #
164
164
  # @return [Try::Value]
165
165
  def recover(*_errors, &) = self
@@ -16,7 +16,7 @@ module Dry
16
16
  #
17
17
  # @example with Maybe
18
18
  # Maybe(Unit)
19
- # => Some(Unit)
19
+ # Some(Unit)
20
20
  #
21
21
  Unit = ::Object.new.tap do |unit|
22
22
  def unit.to_s = "Unit"
@@ -3,6 +3,6 @@
3
3
  module Dry
4
4
  module Monads
5
5
  # Gem version
6
- VERSION = "1.9.0"
6
+ VERSION = "1.10.0"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-monads
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
- - Nikita Shilnikov
8
- autorequire:
9
- bindir: bin
7
+ - Hanakai team
8
+ bindir: exe
10
9
  cert_chain: []
11
- date: 2025-06-24 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: concurrent-ruby
@@ -52,12 +51,71 @@ dependencies:
52
51
  - - "~>"
53
52
  - !ruby/object:Gem::Version
54
53
  version: '2.6'
54
+ - !ruby/object:Gem::Dependency
55
+ name: bundler
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: debug_inspector
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ - !ruby/object:Gem::Dependency
83
+ name: rake
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ - !ruby/object:Gem::Dependency
97
+ name: rspec
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
55
110
  description: Common monads for Ruby
56
111
  email:
57
- - fg@flashgordon.ru
112
+ - info@hanakai.org
58
113
  executables: []
59
114
  extensions: []
60
- extra_rdoc_files: []
115
+ extra_rdoc_files:
116
+ - CHANGELOG.md
117
+ - LICENSE
118
+ - README.md
61
119
  files:
62
120
  - CHANGELOG.md
63
121
  - LICENSE
@@ -96,12 +154,10 @@ homepage: https://dry-rb.org/gems/dry-monads
96
154
  licenses:
97
155
  - MIT
98
156
  metadata:
99
- allowed_push_host: https://rubygems.org
100
157
  changelog_uri: https://github.com/dry-rb/dry-monads/blob/main/CHANGELOG.md
101
158
  source_code_uri: https://github.com/dry-rb/dry-monads
102
159
  bug_tracker_uri: https://github.com/dry-rb/dry-monads/issues
103
- rubygems_mfa_required: 'true'
104
- post_install_message:
160
+ funding_uri: https://github.com/sponsors/hanami
105
161
  rdoc_options: []
106
162
  require_paths:
107
163
  - lib
@@ -116,8 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
172
  - !ruby/object:Gem::Version
117
173
  version: '0'
118
174
  requirements: []
119
- rubygems_version: 3.3.27
120
- signing_key:
175
+ rubygems_version: 3.6.9
121
176
  specification_version: 4
122
177
  summary: Common monads for Ruby
123
178
  test_files: []