dry-logic 1.0.2 → 1.0.8

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.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +129 -26
  3. data/LICENSE +1 -1
  4. data/README.md +12 -14
  5. data/dry-logic.gemspec +27 -14
  6. data/lib/dry-logic.rb +1 -1
  7. data/lib/dry/logic.rb +2 -2
  8. data/lib/dry/logic/evaluator.rb +1 -1
  9. data/lib/dry/logic/operations.rb +11 -11
  10. data/lib/dry/logic/operations/abstract.rb +6 -6
  11. data/lib/dry/logic/operations/and.rb +4 -4
  12. data/lib/dry/logic/operations/attr.rb +1 -1
  13. data/lib/dry/logic/operations/binary.rb +1 -1
  14. data/lib/dry/logic/operations/check.rb +4 -4
  15. data/lib/dry/logic/operations/each.rb +2 -2
  16. data/lib/dry/logic/operations/implication.rb +2 -2
  17. data/lib/dry/logic/operations/key.rb +5 -5
  18. data/lib/dry/logic/operations/negation.rb +2 -2
  19. data/lib/dry/logic/operations/or.rb +2 -2
  20. data/lib/dry/logic/operations/set.rb +3 -3
  21. data/lib/dry/logic/operations/unary.rb +1 -1
  22. data/lib/dry/logic/operations/xor.rb +2 -2
  23. data/lib/dry/logic/operators.rb +4 -4
  24. data/lib/dry/logic/predicates.rb +60 -28
  25. data/lib/dry/logic/result.rb +2 -2
  26. data/lib/dry/logic/rule.rb +11 -11
  27. data/lib/dry/logic/rule/interface.rb +32 -37
  28. data/lib/dry/logic/rule/predicate.rb +3 -3
  29. data/lib/dry/logic/rule_compiler.rb +3 -3
  30. data/lib/dry/logic/version.rb +1 -1
  31. metadata +12 -133
  32. data/.codeclimate.yml +0 -15
  33. data/.gitignore +0 -9
  34. data/.rspec +0 -3
  35. data/.travis.yml +0 -31
  36. data/CONTRIBUTING.md +0 -29
  37. data/Gemfile +0 -15
  38. data/Rakefile +0 -14
  39. data/benchmarks/rule_application.rb +0 -30
  40. data/benchmarks/setup.rb +0 -13
  41. data/bin/console +0 -11
  42. data/examples/basic.rb +0 -16
  43. data/spec/integration/result_spec.rb +0 -61
  44. data/spec/integration/rule_spec.rb +0 -55
  45. data/spec/shared/predicates.rb +0 -59
  46. data/spec/shared/rule.rb +0 -74
  47. data/spec/spec_helper.rb +0 -36
  48. data/spec/support/mutant.rb +0 -11
  49. data/spec/unit/operations/and_spec.rb +0 -70
  50. data/spec/unit/operations/attr_spec.rb +0 -29
  51. data/spec/unit/operations/check_spec.rb +0 -51
  52. data/spec/unit/operations/each_spec.rb +0 -49
  53. data/spec/unit/operations/implication_spec.rb +0 -32
  54. data/spec/unit/operations/key_spec.rb +0 -135
  55. data/spec/unit/operations/negation_spec.rb +0 -51
  56. data/spec/unit/operations/or_spec.rb +0 -75
  57. data/spec/unit/operations/set_spec.rb +0 -43
  58. data/spec/unit/operations/xor_spec.rb +0 -63
  59. data/spec/unit/predicates/array_spec.rb +0 -43
  60. data/spec/unit/predicates/attr_spec.rb +0 -31
  61. data/spec/unit/predicates/bool_spec.rb +0 -36
  62. data/spec/unit/predicates/case_spec.rb +0 -35
  63. data/spec/unit/predicates/date_spec.rb +0 -33
  64. data/spec/unit/predicates/date_time_spec.rb +0 -33
  65. data/spec/unit/predicates/decimal_spec.rb +0 -34
  66. data/spec/unit/predicates/empty_spec.rb +0 -40
  67. data/spec/unit/predicates/eql_spec.rb +0 -23
  68. data/spec/unit/predicates/even_spec.rb +0 -33
  69. data/spec/unit/predicates/excluded_from_spec.rb +0 -37
  70. data/spec/unit/predicates/excludes_spec.rb +0 -58
  71. data/spec/unit/predicates/false_spec.rb +0 -37
  72. data/spec/unit/predicates/filled_spec.rb +0 -40
  73. data/spec/unit/predicates/float_spec.rb +0 -33
  74. data/spec/unit/predicates/format_spec.rb +0 -23
  75. data/spec/unit/predicates/gt_spec.rb +0 -42
  76. data/spec/unit/predicates/gteq_spec.rb +0 -42
  77. data/spec/unit/predicates/included_in_spec.rb +0 -37
  78. data/spec/unit/predicates/includes_spec.rb +0 -24
  79. data/spec/unit/predicates/int_spec.rb +0 -36
  80. data/spec/unit/predicates/key_spec.rb +0 -31
  81. data/spec/unit/predicates/lt_spec.rb +0 -42
  82. data/spec/unit/predicates/lteq_spec.rb +0 -42
  83. data/spec/unit/predicates/max_size_spec.rb +0 -51
  84. data/spec/unit/predicates/min_size_spec.rb +0 -51
  85. data/spec/unit/predicates/none_spec.rb +0 -30
  86. data/spec/unit/predicates/not_eql_spec.rb +0 -23
  87. data/spec/unit/predicates/number_spec.rb +0 -39
  88. data/spec/unit/predicates/odd_spec.rb +0 -33
  89. data/spec/unit/predicates/respond_to_spec.rb +0 -31
  90. data/spec/unit/predicates/size_spec.rb +0 -57
  91. data/spec/unit/predicates/str_spec.rb +0 -34
  92. data/spec/unit/predicates/time_spec.rb +0 -33
  93. data/spec/unit/predicates/true_spec.rb +0 -37
  94. data/spec/unit/predicates/type_spec.rb +0 -37
  95. data/spec/unit/predicates/uuid_v4_spec.rb +0 -29
  96. data/spec/unit/predicates_spec.rb +0 -25
  97. data/spec/unit/rule/predicate_spec.rb +0 -55
  98. data/spec/unit/rule_compiler_spec.rb +0 -129
  99. data/spec/unit/rule_spec.rb +0 -213
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '092fd6393e21a754ce653a7b24dfdcb2dacb719723b9e3bb6607c2ba73962bde'
4
- data.tar.gz: 3b3a2407f0cdf5f4d17c3bae1888f32d8c63ca666cecc5d6266ee4604ce6f551
3
+ metadata.gz: 18fd19e7ba009817c12de16b828fb0e1dd04f1e5d2305fa9eeb8be9a55681473
4
+ data.tar.gz: a4f2ff3297ab4684323489bd0a371f759b1b99d0a5c5f5425a3158f4d8af45e7
5
5
  SHA512:
6
- metadata.gz: a0ddca4a58b60a896077cc5c1d4b66e4c54470fb4182475e343bc90e3cdb6ec0e913784fc0c992c6e247532cfcdd50c2d47f48f467f443b71cab0f92fbf5d6da
7
- data.tar.gz: a164d2b12242437c48d035e0cb139b1a24373d1d79f074d6b718fb81e7a6303f23cfc85c352fbfe8fdd9adf9602e44049d0bdcb15689d376b43a5b56fce549a6
6
+ metadata.gz: c57af697d43afe951a6cfdce3a9afd2ce12399b95e6d48f9468c84a2de33299d8a20b8f1851652a86cb922868974b2be80f434d38c8086022db42d9baa7df5dc
7
+ data.tar.gz: a33e8cfcec95668d7189ac1921bce8c88602dd25fea59f10174cef42ff7130cd9bb4285884d4c241eeb98fcd842a5268078c14649851e1b24fc20a56633fcd43
@@ -1,39 +1,122 @@
1
- # v1.0.1 2019-06-04 (yanked)
1
+ ## unreleased
2
+
3
+
4
+ ### Fixed
5
+
6
+ - Better Ruby 3 support with fixed specialization for rules of negative arity (@flash-gordon)
7
+
8
+
9
+ [Compare v1.0.7...master](https://github.com/dry-rb/dry-logic/compare/v1.0.7...master)
10
+
11
+ ## 1.0.7 2020-08-13
12
+
13
+
14
+ ### Added
15
+
16
+ - A new `uri?` predicate that you can use to verify `URI` strings, ie `uri?("https", "https://dry-rb.org")` (@nerburish)
17
+ - New predicates: `uuid_v1?`, `uuid_v2?`, `uuid_v3?` and `uuid_v5?` (via #75) (@jamesbrauman)
18
+
19
+
20
+ [Compare v1.0.6...v1.0.7](https://github.com/dry-rb/dry-logic/compare/v1.0.6...v1.0.7)
21
+
22
+ ## 1.0.6 2020-02-10
23
+
24
+
25
+ ### Fixed
26
+
27
+ - Made the regexp used by `uuid_v4?` more secure (@kml)
28
+
29
+
30
+ [Compare v1.0.5...v1.0.6](https://github.com/dry-rb/dry-logic/compare/v1.0.5...v1.0.6)
31
+
32
+ ## 1.0.5 2019-11-07
33
+
34
+
35
+ ### Fixed
36
+
37
+ - Make `format?` tolerant to `nil` values. It already worked like that before, but starting Ruby 2.7 it would produce warnings. Now it won't. Don't rely on this behavior, it's only added to make tests pass in dry-schema. Use explicit type checks instead (@flash-gordon)
38
+
39
+
40
+ [Compare v1.0.4...v1.0.5](https://github.com/dry-rb/dry-logic/compare/v1.0.4...v1.0.5)
41
+
42
+ ## 1.0.4 2019-11-06
43
+
44
+
45
+ ### Fixed
46
+
47
+ - Fix keyword warnings (@flash-gordon)
48
+
49
+
50
+ [Compare v1.0.3...v1.0.4](https://github.com/dry-rb/dry-logic/compare/v1.0.3...v1.0.4)
51
+
52
+ ## 1.0.3 2019-08-01
53
+
54
+
55
+ ### Added
56
+
57
+ - `bytesize?` predicate (@bmalinconico)
58
+ - `min_bytesize?` predicate (@bmalinconico)
59
+ - `max_bytesize? predicate (@bmalinconico)
60
+
61
+ ### Changed
62
+
63
+ - Min ruby version was set to `>= 2.4.0` (@flash-gordon)
64
+
65
+ [Compare v1.0.2...v1.0.3](https://github.com/dry-rb/dry-logic/compare/v1.0.2...v1.0.3)
66
+
67
+ ## 1.0.2 2019-06-14
68
+
69
+ Re-pushed 1.0.1 after dry-schema 1.2.0 release.
70
+
71
+
72
+ [Compare v1.0.1...v1.0.2](https://github.com/dry-rb/dry-logic/compare/v1.0.1...v1.0.2)
73
+
74
+ ## 1.0.1 2019-06-04
75
+
76
+ This release was removed from rubygems because it broke dry-schema.
2
77
 
3
78
  ### Added
4
79
 
5
80
  - `uuid_v4?` predicate (radar)
6
81
  - `respond_to?` predicate (waiting-for-dev)
7
82
 
83
+
8
84
  [Compare v1.0.0...v1.0.1](https://github.com/dry-rb/dry-logic/compare/v1.0.0...v1.0.1)
9
85
 
10
- This release was removed from rubygems because it broke dry-schema.
86
+ ## 1.0.0 2019-04-23
11
87
 
12
- # v1.0.0 2019-04-23
13
88
 
14
- * Version bump to `1.0.0` (flash-gordon)
89
+ ### Changed
90
+
91
+ - Version bump to `1.0.0` (flash-gordon)
15
92
 
16
93
  [Compare v0.6.1...v1.0.0](https://github.com/dry-rb/dry-logic/compare/v0.6.1...v1.0.0)
17
94
 
18
- # v0.6.1 2019-04-18
95
+ ## 0.6.1 2019-04-18
96
+
97
+
98
+ ### Fixed
99
+
100
+ - Fix a regression in dry-validation 0.x for argument-less predicates (flash-gordon)
19
101
 
20
- * Fix a regression in dry-validation 0.x for argument-less predicates (flash-gordon)
21
102
 
22
103
  [Compare v0.6.0...v0.6.1](https://github.com/dry-rb/dry-logic/compare/v0.6.0...v0.6.1)
23
104
 
24
- # v0.6.0 2019-04-04
105
+ ## 0.6.0 2019-04-04
106
+
25
107
 
26
108
  ### Added
27
109
 
28
- * Generating hints can be disabled by building `Operations::And` with `hints: false` option set (solnic)
110
+ - Generating hints can be disabled by building `Operations::And` with `hints: false` option set (solnic)
29
111
 
30
112
  ### Changed
31
113
 
32
- * `Rule` construction has been optimized so that currying and application is multiple-times faster (flash-gordon)
114
+ - `Rule` construction has been optimized so that currying and application is multiple-times faster (flash-gordon)
33
115
 
34
116
  [Compare v0.5.0...v0.6.0](https://github.com/dry-rb/dry-logic/compare/v0.5.0...v0.6.0)
35
117
 
36
- # v0.5.0 2019-01-29
118
+ ## 0.5.0 2019-01-29
119
+
37
120
 
38
121
  ### Added
39
122
 
@@ -43,9 +126,11 @@ This release was removed from rubygems because it broke dry-schema.
43
126
 
44
127
  - `Operation::Key#ast` will now return a correct AST with non-Undefined inputs (solnic)
45
128
 
129
+
46
130
  [Compare v0.4.2...v0.5.0](https://github.com/dry-rb/dry-logic/compare/v0.4.2...v0.5.0)
47
131
 
48
- # v0.4.2 2017-09-15
132
+ ## 0.4.2 2017-09-15
133
+
49
134
 
50
135
  ### Added
51
136
 
@@ -56,21 +141,23 @@ This release was removed from rubygems because it broke dry-schema.
56
141
 
57
142
  - A bug with using custom predicates within a standalone module in `dry-validation` (flash-gordon)
58
143
 
59
- [Compare v0.4.1...v0.4.2](https://github.com/dry-rb/dry-logic/compare/v0.4.1...v0.4.2)
60
144
 
61
- # v0.4.1 2017-01-23
145
+ [Compare v0.4.1...v0.4.2](https://github.com/dry-rb/dry-logic/compare/v0.4.1...v0.4.2)
62
146
 
63
- ### Changed
147
+ ## 0.4.1 2017-01-23
64
148
 
65
- - Predicates simply reuse other predicate methods instead of referring to them via `#[]` (georgemillo)
66
149
 
67
150
  ### Fixed
68
151
 
69
152
  - Warnings on MRI 2.4.0 are gone (jtippett)
70
153
 
154
+ ### Changed
155
+
156
+ - Predicates simply reuse other predicate methods instead of referring to them via `#[]` (georgemillo)
157
+
71
158
  [Compare v0.4.0...v0.4.1](https://github.com/dry-rb/dry-logic/compare/v0.4.0...v0.4.1)
72
159
 
73
- # v0.4.0 2016-09-21
160
+ ## 0.4.0 2016-09-21
74
161
 
75
162
  This is a partial rewrite focused on internal clean up and major performance improvements. This is also the beginning of the work to make this library first-class rather than "just" a rule backend for dry-validation and dry-types.
76
163
 
@@ -98,7 +185,8 @@ This is a partial rewrite focused on internal clean up and major performance imp
98
185
 
99
186
  [Compare v0.3.0...v0.4.0](https://github.com/dry-rb/dry-logic/compare/v0.3.0...v0.4.0)
100
187
 
101
- # v0.3.0 2016-07-01
188
+ ## 0.3.0 2016-07-01
189
+
102
190
 
103
191
  ### Added
104
192
 
@@ -113,7 +201,8 @@ This is a partial rewrite focused on internal clean up and major performance imp
113
201
 
114
202
  [Compare v0.2.3...v0.3.0](https://github.com/dry-rb/dry-logic/compare/v0.2.3...v0.3.0)
115
203
 
116
- # v0.2.3 2016-05-11
204
+ ## 0.2.3 2016-05-11
205
+
117
206
 
118
207
  ### Added
119
208
 
@@ -126,21 +215,28 @@ This is a partial rewrite focused on internal clean up and major performance imp
126
215
 
127
216
  [Compare v0.2.2...v0.2.3](https://github.com/dry-rb/dry-logic/compare/v0.2.2...v0.2.3)
128
217
 
129
- # v0.2.2 2016-03-30
218
+ ## 0.2.2 2016-03-30
219
+
130
220
 
131
221
  ### Added
132
222
 
133
223
  - `number?`, `odd?`, `even?` predicates (fran-worley)
134
224
 
225
+
135
226
  [Compare v0.2.1...v0.2.2](https://github.com/dry-rb/dry-logic/compare/v0.2.1...v0.2.2)
136
227
 
137
- # v0.2.1 2016-03-20
228
+ ## 0.2.1 2016-03-20
229
+
138
230
 
139
231
  ### Fixed
140
232
 
141
233
  - Result AST for `Rule::Each` correctly maps elements with eql inputs (solnic)
142
234
 
143
- # v0.2.0 2016-03-11
235
+
236
+ [Compare v0.2.0...v0.2.1](https://github.com/dry-rb/dry-logic/compare/v0.2.0...v0.2.1)
237
+
238
+ ## 0.2.0 2016-03-11
239
+
144
240
 
145
241
  ### Changed
146
242
 
@@ -148,16 +244,19 @@ This is a partial rewrite focused on internal clean up and major performance imp
148
244
 
149
245
  [Compare v0.1.4...v0.2.0](https://github.com/dry-rb/dry-logic/compare/v0.1.4...v0.2.0)
150
246
 
151
- # v0.1.4 2016-01-27
247
+ ## 0.1.4 2016-01-27
248
+
152
249
 
153
250
  ### Added
154
251
 
155
252
  - Support for hash-names in `Check` and `Result` which can properly resolve input
156
253
  from nested results (solnic)
157
254
 
255
+
158
256
  [Compare v0.1.3...v0.1.4](https://github.com/dry-rb/dry-logic/compare/v0.1.3...v0.1.4)
159
257
 
160
- # v0.1.3 2016-01-27
258
+ ## 0.1.3 2016-01-27
259
+
161
260
 
162
261
  ### Added
163
262
 
@@ -169,15 +268,18 @@ This is a partial rewrite focused on internal clean up and major performance imp
169
268
 
170
269
  [Compare v0.1.2...v0.1.3](https://github.com/dry-rb/dry-logic/compare/v0.1.2...v0.1.3)
171
270
 
172
- # v0.1.2 2016-01-19
271
+ ## 0.1.2 2016-01-19
272
+
173
273
 
174
274
  ### Fixed
175
275
 
176
276
  - `xor` returns wrapped results when used against another result-rule (solnic)
177
277
 
278
+
178
279
  [Compare v0.1.1...v0.1.2](https://github.com/dry-rb/dry-logic/compare/v0.1.1...v0.1.2)
179
280
 
180
- # v0.1.1 2016-01-18
281
+ ## 0.1.1 2016-01-18
282
+
181
283
 
182
284
  ### Added
183
285
 
@@ -185,8 +287,9 @@ This is a partial rewrite focused on internal clean up and major performance imp
185
287
  - `Rule::Result` which can be applied to a result object (solnic)
186
288
  - `true?` and `false?` predicates (solnic)
187
289
 
290
+
188
291
  [Compare v0.1.0...v0.1.1](https://github.com/dry-rb/dry-logic/compare/v0.1.0...v0.1.1)
189
292
 
190
- # v0.1.0 2016-01-11
293
+ ## 0.1.0 2016-01-11
191
294
 
192
295
  Code extracted from dry-validation 0.4.1
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014 Ruby Object Mapper
3
+ Copyright (c) 2015-2020 dry-rb 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,30 +1,28 @@
1
1
  [gem]: https://rubygems.org/gems/dry-logic
2
- [travis]: https://travis-ci.org/dry-rb/dry-logic
3
- [codeclimate]: https://codeclimate.com/github/dry-rb/dry-logic
2
+ [actions]: https://github.com/dry-rb/dry-logic/actions
3
+ [codacy]: https://www.codacy.com/gh/dry-rb/dry-logic
4
4
  [chat]: https://dry-rb.zulipchat.com
5
5
  [inchpages]: http://inch-ci.org/github/dry-rb/dry-logic
6
6
 
7
7
  # dry-logic [![Join the chat at https://dry-rb.zulipchat.com](https://img.shields.io/badge/dry--rb-join%20chat-%23346b7a.svg)][chat]
8
8
 
9
9
  [![Gem Version](https://badge.fury.io/rb/dry-logic.svg)][gem]
10
- [![Build Status](https://travis-ci.org/dry-rb/dry-logic.svg?branch=master)][travis]
11
- [![Code Climate](https://codeclimate.com/github/dry-rb/dry-logic/badges/gpa.svg)][codeclimate]
12
- [![Test Coverage](https://codeclimate.com/github/dry-rb/dry-logic/badges/coverage.svg)][codeclimate]
10
+ [![CI Status](https://github.com/dry-rb/dry-logic/workflows/ci/badge.svg)][actions]
11
+ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/3ac6ea12c2dd42beb36dc3abe63d9606)][codacy]
12
+ [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/3ac6ea12c2dd42beb36dc3abe63d9606)][codacy]
13
13
  [![Inline docs](http://inch-ci.org/github/dry-rb/dry-logic.svg?branch=master)][inchpages]
14
14
 
15
- Predicate logic and rule composition used by:
16
-
17
- * [dry-types](https://github.com/dry-rb/dry-types) for constrained types
18
- * [dry-schema](https://github.com/dry-rb/dry-schema) and [dry-validation](https://github.com/dry-rb/dry-validation) for composing validation rules
19
- * your project...?
20
-
21
15
  ## Links
22
16
 
23
- * [Documentation](http://dry-rb.org/gems/dry-logic)
17
+ * [User documentation](http://dry-rb.org/gems/dry-logic)
18
+ * [API documentation](http://rubydoc.info/gems/dry-logic)
19
+
20
+ ## Supported Ruby versions
24
21
 
25
- ## Contributing
22
+ This library officially supports the following Ruby versions:
26
23
 
27
- Bug reports and pull requests are welcome on GitHub at https://github.com/dry-rb/dry-logic.
24
+ * MRI >= `2.4`
25
+ * jruby >= `9.2`
28
26
 
29
27
  ## License
30
28
 
@@ -1,25 +1,38 @@
1
1
  # frozen_string_literal: true
2
+ # this file is managed by dry-rb/devtools project
2
3
 
3
- require File.expand_path('../lib/dry/logic/version', __FILE__)
4
+ lib = File.expand_path('lib', __dir__)
5
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
+ require 'dry/logic/version'
4
7
 
5
8
  Gem::Specification.new do |spec|
6
9
  spec.name = 'dry-logic'
7
- spec.version = Dry::Logic::VERSION
8
- spec.authors = ['Piotr Solnica']
9
- spec.email = ['piotr.solnica@gmail.com']
10
- spec.summary = 'Predicate logic with rule composition'
11
- spec.homepage = 'https://github.com/dry-rb/dry-logic'
10
+ spec.authors = ["Piotr Solnica"]
11
+ spec.email = ["piotr.solnica@gmail.com"]
12
12
  spec.license = 'MIT'
13
+ spec.version = Dry::Logic::VERSION.dup
13
14
 
14
- spec.files = `git ls-files -z`.split("\x0")
15
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
+ spec.summary = "Predicate logic with rule composition"
16
+ spec.description = spec.summary
17
+ spec.homepage = 'https://dry-rb.org/gems/dry-logic'
18
+ spec.files = Dir["CHANGELOG.md", "LICENSE", "README.md", "dry-logic.gemspec", "lib/**/*"]
19
+ spec.bindir = 'bin'
20
+ spec.executables = []
16
21
  spec.require_paths = ['lib']
17
22
 
18
- spec.add_runtime_dependency 'concurrent-ruby', '~> 1.0'
19
- spec.add_runtime_dependency 'dry-core', '~> 0.2'
20
- spec.add_runtime_dependency 'dry-equalizer', '~> 0.2'
23
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
24
+ spec.metadata['changelog_uri'] = 'https://github.com/dry-rb/dry-logic/blob/master/CHANGELOG.md'
25
+ spec.metadata['source_code_uri'] = 'https://github.com/dry-rb/dry-logic'
26
+ spec.metadata['bug_tracker_uri'] = 'https://github.com/dry-rb/dry-logic/issues'
21
27
 
22
- spec.add_development_dependency 'bundler'
23
- spec.add_development_dependency 'rake'
24
- spec.add_development_dependency 'rspec'
28
+ spec.required_ruby_version = ">= 2.4.0"
29
+
30
+ # to update dependencies edit project.yml
31
+ spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
32
+ spec.add_runtime_dependency "dry-core", "~> 0.2"
33
+ spec.add_runtime_dependency "dry-equalizer", "~> 0.2"
34
+
35
+ spec.add_development_dependency "bundler"
36
+ spec.add_development_dependency "rake"
37
+ spec.add_development_dependency "rspec"
25
38
  end
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/logic'
3
+ require "dry/logic"
@@ -7,5 +7,5 @@ module Dry
7
7
  end
8
8
  end
9
9
 
10
- require 'dry/logic/rule/predicate'
11
- require 'dry/logic/operations'
10
+ require "dry/logic/rule/predicate"
11
+ require "dry/logic/operations"
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/equalizer'
3
+ require "dry/equalizer"
4
4
 
5
5
  module Dry
6
6
  module Logic
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/logic/operations/and'
4
- require 'dry/logic/operations/or'
5
- require 'dry/logic/operations/xor'
6
- require 'dry/logic/operations/implication'
7
- require 'dry/logic/operations/negation'
3
+ require "dry/logic/operations/and"
4
+ require "dry/logic/operations/or"
5
+ require "dry/logic/operations/xor"
6
+ require "dry/logic/operations/implication"
7
+ require "dry/logic/operations/negation"
8
8
 
9
- require 'dry/logic/operations/key'
10
- require 'dry/logic/operations/attr'
11
- require 'dry/logic/operations/each'
12
- require 'dry/logic/operations/set'
13
- require 'dry/logic/operations/check'
9
+ require "dry/logic/operations/key"
10
+ require "dry/logic/operations/attr"
11
+ require "dry/logic/operations/each"
12
+ require "dry/logic/operations/set"
13
+ require "dry/logic/operations/check"
14
14
 
15
- require 'dry/logic/operators'
15
+ require "dry/logic/operators"
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/core/constants'
4
- require 'dry/equalizer'
5
- require 'dry/logic/operators'
3
+ require "dry/core/constants"
4
+ require "dry/equalizer"
5
+ require "dry/logic/operators"
6
6
 
7
7
  module Dry
8
8
  module Logic
@@ -26,15 +26,15 @@ module Dry
26
26
  end
27
27
 
28
28
  def curry(*args)
29
- new(rules.map { |rule| rule.curry(*args) }, options)
29
+ new(rules.map { |rule| rule.curry(*args) }, **options)
30
30
  end
31
31
 
32
32
  def new(rules, **new_options)
33
- self.class.new(*rules, options.merge(new_options))
33
+ self.class.new(*rules, **options, **new_options)
34
34
  end
35
35
 
36
36
  def with(new_options)
37
- new(rules, options.merge(new_options))
37
+ new(rules, **options, **new_options)
38
38
  end
39
39
 
40
40
  def to_ast