dry-logic 1.0.0 → 1.0.6
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 +4 -4
- data/CHANGELOG.md +117 -24
- data/LICENSE +1 -1
- data/README.md +12 -14
- data/dry-logic.gemspec +29 -14
- data/lib/dry-logic.rb +2 -0
- data/lib/dry/logic.rb +2 -0
- data/lib/dry/logic/appliable.rb +2 -0
- data/lib/dry/logic/evaluator.rb +2 -0
- data/lib/dry/logic/operations.rb +2 -0
- data/lib/dry/logic/operations/abstract.rb +5 -3
- data/lib/dry/logic/operations/and.rb +3 -1
- data/lib/dry/logic/operations/attr.rb +2 -0
- data/lib/dry/logic/operations/binary.rb +2 -0
- data/lib/dry/logic/operations/check.rb +3 -1
- data/lib/dry/logic/operations/each.rb +2 -0
- data/lib/dry/logic/operations/implication.rb +2 -0
- data/lib/dry/logic/operations/key.rb +4 -2
- data/lib/dry/logic/operations/negation.rb +2 -0
- data/lib/dry/logic/operations/or.rb +2 -0
- data/lib/dry/logic/operations/set.rb +2 -0
- data/lib/dry/logic/operations/unary.rb +2 -0
- data/lib/dry/logic/operations/xor.rb +2 -0
- data/lib/dry/logic/operators.rb +2 -0
- data/lib/dry/logic/predicates.rb +39 -21
- data/lib/dry/logic/result.rb +2 -0
- data/lib/dry/logic/rule.rb +5 -3
- data/lib/dry/logic/rule/interface.rb +3 -1
- data/lib/dry/logic/rule/predicate.rb +2 -0
- data/lib/dry/logic/rule_compiler.rb +2 -0
- data/lib/dry/logic/version.rb +3 -1
- metadata +11 -128
- data/.codeclimate.yml +0 -15
- data/.gitignore +0 -9
- data/.rspec +0 -3
- data/.travis.yml +0 -31
- data/CONTRIBUTING.md +0 -29
- data/Gemfile +0 -13
- data/Rakefile +0 -12
- data/benchmarks/rule_application.rb +0 -28
- data/benchmarks/setup.rb +0 -11
- data/bin/console +0 -10
- data/examples/basic.rb +0 -14
- data/spec/integration/result_spec.rb +0 -59
- data/spec/integration/rule_spec.rb +0 -53
- data/spec/shared/predicates.rb +0 -57
- data/spec/shared/rule.rb +0 -72
- data/spec/spec_helper.rb +0 -34
- data/spec/support/mutant.rb +0 -9
- data/spec/unit/operations/and_spec.rb +0 -68
- data/spec/unit/operations/attr_spec.rb +0 -27
- data/spec/unit/operations/check_spec.rb +0 -49
- data/spec/unit/operations/each_spec.rb +0 -47
- data/spec/unit/operations/implication_spec.rb +0 -30
- data/spec/unit/operations/key_spec.rb +0 -133
- data/spec/unit/operations/negation_spec.rb +0 -49
- data/spec/unit/operations/or_spec.rb +0 -73
- data/spec/unit/operations/set_spec.rb +0 -41
- data/spec/unit/operations/xor_spec.rb +0 -61
- data/spec/unit/predicates/array_spec.rb +0 -41
- data/spec/unit/predicates/attr_spec.rb +0 -29
- data/spec/unit/predicates/bool_spec.rb +0 -34
- data/spec/unit/predicates/case_spec.rb +0 -33
- data/spec/unit/predicates/date_spec.rb +0 -31
- data/spec/unit/predicates/date_time_spec.rb +0 -31
- data/spec/unit/predicates/decimal_spec.rb +0 -32
- data/spec/unit/predicates/empty_spec.rb +0 -38
- data/spec/unit/predicates/eql_spec.rb +0 -21
- data/spec/unit/predicates/even_spec.rb +0 -31
- data/spec/unit/predicates/excluded_from_spec.rb +0 -35
- data/spec/unit/predicates/excludes_spec.rb +0 -56
- data/spec/unit/predicates/false_spec.rb +0 -35
- data/spec/unit/predicates/filled_spec.rb +0 -38
- data/spec/unit/predicates/float_spec.rb +0 -31
- data/spec/unit/predicates/format_spec.rb +0 -21
- data/spec/unit/predicates/gt_spec.rb +0 -40
- data/spec/unit/predicates/gteq_spec.rb +0 -40
- data/spec/unit/predicates/included_in_spec.rb +0 -35
- data/spec/unit/predicates/includes_spec.rb +0 -24
- data/spec/unit/predicates/int_spec.rb +0 -34
- data/spec/unit/predicates/key_spec.rb +0 -29
- data/spec/unit/predicates/lt_spec.rb +0 -40
- data/spec/unit/predicates/lteq_spec.rb +0 -40
- data/spec/unit/predicates/max_size_spec.rb +0 -49
- data/spec/unit/predicates/min_size_spec.rb +0 -49
- data/spec/unit/predicates/none_spec.rb +0 -28
- data/spec/unit/predicates/not_eql_spec.rb +0 -21
- data/spec/unit/predicates/number_spec.rb +0 -37
- data/spec/unit/predicates/odd_spec.rb +0 -31
- data/spec/unit/predicates/size_spec.rb +0 -55
- data/spec/unit/predicates/str_spec.rb +0 -32
- data/spec/unit/predicates/time_spec.rb +0 -31
- data/spec/unit/predicates/true_spec.rb +0 -35
- data/spec/unit/predicates/type_spec.rb +0 -35
- data/spec/unit/predicates_spec.rb +0 -23
- data/spec/unit/rule/predicate_spec.rb +0 -53
- data/spec/unit/rule_compiler_spec.rb +0 -127
- data/spec/unit/rule_spec.rb +0 -211
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a6c0b350baaf47853027db9d61e790c195ced412ff40a9ecaac56b6588172da3
|
|
4
|
+
data.tar.gz: 966f1daee610a4eea2eae78743e8e17f0e57084b1106fd3f033483329895a4a1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 98002481f3e8cc83affa67ff7b3f8e69b22836f0737112bba1d4c656f39cbc06d9657bdb7865326fb9b6531660a9fd260b60d18d2062d9d149a97f25154a3974
|
|
7
|
+
data.tar.gz: cc6163b44e7e2ef296901e35085fa42290ad8b4b936237e26409f7f71d90041e12472322319d3dc8553fb46dcf532b2747b68b1d3a5cd46e81bb94fb298cf56c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,28 +1,101 @@
|
|
|
1
|
-
|
|
1
|
+
## 1.0.6 2020-02-10
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
### Fixed
|
|
5
|
+
|
|
6
|
+
- Made the regexp used by `uuid_v4?` more secure (@kml)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
[Compare v1.0.5...v1.0.6](https://github.com/dry-rb/dry-logic/compare/v1.0.5...v1.0.6)
|
|
10
|
+
|
|
11
|
+
## 1.0.5 2019-11-07
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- 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)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
[Compare v1.0.4...v1.0.5](https://github.com/dry-rb/dry-logic/compare/v1.0.4...v1.0.5)
|
|
20
|
+
|
|
21
|
+
## 1.0.4 2019-11-06
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- Fix keyword warnings (@flash-gordon)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
[Compare v1.0.3...v1.0.4](https://github.com/dry-rb/dry-logic/compare/v1.0.3...v1.0.4)
|
|
30
|
+
|
|
31
|
+
## 1.0.3 2019-08-01
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- `bytesize?` predicate (@bmalinconico)
|
|
37
|
+
- `min_bytesize?` predicate (@bmalinconico)
|
|
38
|
+
- `max_bytesize? predicate (@bmalinconico)
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- Min ruby version was set to `>= 2.4.0` (@flash-gordon)
|
|
43
|
+
|
|
44
|
+
[Compare v1.0.2...v1.0.3](https://github.com/dry-rb/dry-logic/compare/v1.0.2...v1.0.3)
|
|
45
|
+
|
|
46
|
+
## 1.0.2 2019-06-14
|
|
47
|
+
|
|
48
|
+
Re-pushed 1.0.1 after dry-schema 1.2.0 release.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
[Compare v1.0.1...v1.0.2](https://github.com/dry-rb/dry-logic/compare/v1.0.1...v1.0.2)
|
|
52
|
+
|
|
53
|
+
## 1.0.1 2019-06-04
|
|
54
|
+
|
|
55
|
+
This release was removed from rubygems because it broke dry-schema.
|
|
56
|
+
|
|
57
|
+
### Added
|
|
58
|
+
|
|
59
|
+
- `uuid_v4?` predicate (radar)
|
|
60
|
+
- `respond_to?` predicate (waiting-for-dev)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
[Compare v1.0.0...v1.0.1](https://github.com/dry-rb/dry-logic/compare/v1.0.0...v1.0.1)
|
|
64
|
+
|
|
65
|
+
## 1.0.0 2019-04-23
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Changed
|
|
69
|
+
|
|
70
|
+
- Version bump to `1.0.0` (flash-gordon)
|
|
4
71
|
|
|
5
72
|
[Compare v0.6.1...v1.0.0](https://github.com/dry-rb/dry-logic/compare/v0.6.1...v1.0.0)
|
|
6
73
|
|
|
7
|
-
|
|
74
|
+
## 0.6.1 2019-04-18
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
### Fixed
|
|
78
|
+
|
|
79
|
+
- Fix a regression in dry-validation 0.x for argument-less predicates (flash-gordon)
|
|
8
80
|
|
|
9
|
-
* Fix a regression in dry-validation 0.x for argument-less predicates (flash-gordon)
|
|
10
81
|
|
|
11
82
|
[Compare v0.6.0...v0.6.1](https://github.com/dry-rb/dry-logic/compare/v0.6.0...v0.6.1)
|
|
12
83
|
|
|
13
|
-
|
|
84
|
+
## 0.6.0 2019-04-04
|
|
85
|
+
|
|
14
86
|
|
|
15
87
|
### Added
|
|
16
88
|
|
|
17
|
-
|
|
89
|
+
- Generating hints can be disabled by building `Operations::And` with `hints: false` option set (solnic)
|
|
18
90
|
|
|
19
91
|
### Changed
|
|
20
92
|
|
|
21
|
-
|
|
93
|
+
- `Rule` construction has been optimized so that currying and application is multiple-times faster (flash-gordon)
|
|
22
94
|
|
|
23
95
|
[Compare v0.5.0...v0.6.0](https://github.com/dry-rb/dry-logic/compare/v0.5.0...v0.6.0)
|
|
24
96
|
|
|
25
|
-
|
|
97
|
+
## 0.5.0 2019-01-29
|
|
98
|
+
|
|
26
99
|
|
|
27
100
|
### Added
|
|
28
101
|
|
|
@@ -32,9 +105,11 @@ Version bump to 1.0.0
|
|
|
32
105
|
|
|
33
106
|
- `Operation::Key#ast` will now return a correct AST with non-Undefined inputs (solnic)
|
|
34
107
|
|
|
108
|
+
|
|
35
109
|
[Compare v0.4.2...v0.5.0](https://github.com/dry-rb/dry-logic/compare/v0.4.2...v0.5.0)
|
|
36
110
|
|
|
37
|
-
|
|
111
|
+
## 0.4.2 2017-09-15
|
|
112
|
+
|
|
38
113
|
|
|
39
114
|
### Added
|
|
40
115
|
|
|
@@ -45,21 +120,23 @@ Version bump to 1.0.0
|
|
|
45
120
|
|
|
46
121
|
- A bug with using custom predicates within a standalone module in `dry-validation` (flash-gordon)
|
|
47
122
|
|
|
48
|
-
[Compare v0.4.1...v0.4.2](https://github.com/dry-rb/dry-logic/compare/v0.4.1...v0.4.2)
|
|
49
123
|
|
|
50
|
-
|
|
124
|
+
[Compare v0.4.1...v0.4.2](https://github.com/dry-rb/dry-logic/compare/v0.4.1...v0.4.2)
|
|
51
125
|
|
|
52
|
-
|
|
126
|
+
## 0.4.1 2017-01-23
|
|
53
127
|
|
|
54
|
-
- Predicates simply reuse other predicate methods instead of referring to them via `#[]` (georgemillo)
|
|
55
128
|
|
|
56
129
|
### Fixed
|
|
57
130
|
|
|
58
131
|
- Warnings on MRI 2.4.0 are gone (jtippett)
|
|
59
132
|
|
|
133
|
+
### Changed
|
|
134
|
+
|
|
135
|
+
- Predicates simply reuse other predicate methods instead of referring to them via `#[]` (georgemillo)
|
|
136
|
+
|
|
60
137
|
[Compare v0.4.0...v0.4.1](https://github.com/dry-rb/dry-logic/compare/v0.4.0...v0.4.1)
|
|
61
138
|
|
|
62
|
-
|
|
139
|
+
## 0.4.0 2016-09-21
|
|
63
140
|
|
|
64
141
|
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.
|
|
65
142
|
|
|
@@ -87,7 +164,8 @@ This is a partial rewrite focused on internal clean up and major performance imp
|
|
|
87
164
|
|
|
88
165
|
[Compare v0.3.0...v0.4.0](https://github.com/dry-rb/dry-logic/compare/v0.3.0...v0.4.0)
|
|
89
166
|
|
|
90
|
-
|
|
167
|
+
## 0.3.0 2016-07-01
|
|
168
|
+
|
|
91
169
|
|
|
92
170
|
### Added
|
|
93
171
|
|
|
@@ -102,7 +180,8 @@ This is a partial rewrite focused on internal clean up and major performance imp
|
|
|
102
180
|
|
|
103
181
|
[Compare v0.2.3...v0.3.0](https://github.com/dry-rb/dry-logic/compare/v0.2.3...v0.3.0)
|
|
104
182
|
|
|
105
|
-
|
|
183
|
+
## 0.2.3 2016-05-11
|
|
184
|
+
|
|
106
185
|
|
|
107
186
|
### Added
|
|
108
187
|
|
|
@@ -115,21 +194,28 @@ This is a partial rewrite focused on internal clean up and major performance imp
|
|
|
115
194
|
|
|
116
195
|
[Compare v0.2.2...v0.2.3](https://github.com/dry-rb/dry-logic/compare/v0.2.2...v0.2.3)
|
|
117
196
|
|
|
118
|
-
|
|
197
|
+
## 0.2.2 2016-03-30
|
|
198
|
+
|
|
119
199
|
|
|
120
200
|
### Added
|
|
121
201
|
|
|
122
202
|
- `number?`, `odd?`, `even?` predicates (fran-worley)
|
|
123
203
|
|
|
204
|
+
|
|
124
205
|
[Compare v0.2.1...v0.2.2](https://github.com/dry-rb/dry-logic/compare/v0.2.1...v0.2.2)
|
|
125
206
|
|
|
126
|
-
|
|
207
|
+
## 0.2.1 2016-03-20
|
|
208
|
+
|
|
127
209
|
|
|
128
210
|
### Fixed
|
|
129
211
|
|
|
130
212
|
- Result AST for `Rule::Each` correctly maps elements with eql inputs (solnic)
|
|
131
213
|
|
|
132
|
-
|
|
214
|
+
|
|
215
|
+
[Compare v0.2.0...v0.2.1](https://github.com/dry-rb/dry-logic/compare/v0.2.0...v0.2.1)
|
|
216
|
+
|
|
217
|
+
## 0.2.0 2016-03-11
|
|
218
|
+
|
|
133
219
|
|
|
134
220
|
### Changed
|
|
135
221
|
|
|
@@ -137,16 +223,19 @@ This is a partial rewrite focused on internal clean up and major performance imp
|
|
|
137
223
|
|
|
138
224
|
[Compare v0.1.4...v0.2.0](https://github.com/dry-rb/dry-logic/compare/v0.1.4...v0.2.0)
|
|
139
225
|
|
|
140
|
-
|
|
226
|
+
## 0.1.4 2016-01-27
|
|
227
|
+
|
|
141
228
|
|
|
142
229
|
### Added
|
|
143
230
|
|
|
144
231
|
- Support for hash-names in `Check` and `Result` which can properly resolve input
|
|
145
232
|
from nested results (solnic)
|
|
146
233
|
|
|
234
|
+
|
|
147
235
|
[Compare v0.1.3...v0.1.4](https://github.com/dry-rb/dry-logic/compare/v0.1.3...v0.1.4)
|
|
148
236
|
|
|
149
|
-
|
|
237
|
+
## 0.1.3 2016-01-27
|
|
238
|
+
|
|
150
239
|
|
|
151
240
|
### Added
|
|
152
241
|
|
|
@@ -158,15 +247,18 @@ This is a partial rewrite focused on internal clean up and major performance imp
|
|
|
158
247
|
|
|
159
248
|
[Compare v0.1.2...v0.1.3](https://github.com/dry-rb/dry-logic/compare/v0.1.2...v0.1.3)
|
|
160
249
|
|
|
161
|
-
|
|
250
|
+
## 0.1.2 2016-01-19
|
|
251
|
+
|
|
162
252
|
|
|
163
253
|
### Fixed
|
|
164
254
|
|
|
165
255
|
- `xor` returns wrapped results when used against another result-rule (solnic)
|
|
166
256
|
|
|
257
|
+
|
|
167
258
|
[Compare v0.1.1...v0.1.2](https://github.com/dry-rb/dry-logic/compare/v0.1.1...v0.1.2)
|
|
168
259
|
|
|
169
|
-
|
|
260
|
+
## 0.1.1 2016-01-18
|
|
261
|
+
|
|
170
262
|
|
|
171
263
|
### Added
|
|
172
264
|
|
|
@@ -174,8 +266,9 @@ This is a partial rewrite focused on internal clean up and major performance imp
|
|
|
174
266
|
- `Rule::Result` which can be applied to a result object (solnic)
|
|
175
267
|
- `true?` and `false?` predicates (solnic)
|
|
176
268
|
|
|
269
|
+
|
|
177
270
|
[Compare v0.1.0...v0.1.1](https://github.com/dry-rb/dry-logic/compare/v0.1.0...v0.1.1)
|
|
178
271
|
|
|
179
|
-
|
|
272
|
+
## 0.1.0 2016-01-11
|
|
180
273
|
|
|
181
274
|
Code extracted from dry-validation 0.4.1
|
data/LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -1,30 +1,28 @@
|
|
|
1
1
|
[gem]: https://rubygems.org/gems/dry-logic
|
|
2
|
-
[
|
|
3
|
-
[
|
|
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 [][chat]
|
|
8
8
|
|
|
9
9
|
[][gem]
|
|
10
|
-
[][actions]
|
|
11
|
+
[][codacy]
|
|
12
|
+
[][codacy]
|
|
13
13
|
[][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
|
-
* [
|
|
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
|
-
|
|
22
|
+
This library officially supports the following Ruby versions:
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+
* MRI >= `2.4`
|
|
25
|
+
* jruby >= `9.2`
|
|
28
26
|
|
|
29
27
|
## License
|
|
30
28
|
|
data/dry-logic.gemspec
CHANGED
|
@@ -1,23 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# this file is managed by dry-rb/devtools project
|
|
3
|
+
|
|
4
|
+
lib = File.expand_path('lib', __dir__)
|
|
5
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
6
|
+
require 'dry/logic/version'
|
|
2
7
|
|
|
3
8
|
Gem::Specification.new do |spec|
|
|
4
9
|
spec.name = 'dry-logic'
|
|
5
|
-
spec.
|
|
6
|
-
spec.
|
|
7
|
-
spec.email = ['piotr.solnica@gmail.com']
|
|
8
|
-
spec.summary = 'Predicate logic with rule composition'
|
|
9
|
-
spec.homepage = 'https://github.com/dry-rb/dry-logic'
|
|
10
|
+
spec.authors = ["Piotr Solnica"]
|
|
11
|
+
spec.email = ["piotr.solnica@gmail.com"]
|
|
10
12
|
spec.license = 'MIT'
|
|
13
|
+
spec.version = Dry::Logic::VERSION.dup
|
|
11
14
|
|
|
12
|
-
spec.
|
|
13
|
-
spec.
|
|
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 = []
|
|
14
21
|
spec.require_paths = ['lib']
|
|
15
22
|
|
|
16
|
-
spec.
|
|
17
|
-
spec.
|
|
18
|
-
spec.
|
|
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'
|
|
27
|
+
|
|
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"
|
|
19
34
|
|
|
20
|
-
spec.add_development_dependency
|
|
21
|
-
spec.add_development_dependency
|
|
22
|
-
spec.add_development_dependency
|
|
35
|
+
spec.add_development_dependency "bundler"
|
|
36
|
+
spec.add_development_dependency "rake"
|
|
37
|
+
spec.add_development_dependency "rspec"
|
|
23
38
|
end
|
data/lib/dry-logic.rb
CHANGED
data/lib/dry/logic.rb
CHANGED
data/lib/dry/logic/appliable.rb
CHANGED
data/lib/dry/logic/evaluator.rb
CHANGED
data/lib/dry/logic/operations.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'dry/core/constants'
|
|
2
4
|
require 'dry/equalizer'
|
|
3
5
|
require 'dry/logic/operators'
|
|
@@ -24,15 +26,15 @@ module Dry
|
|
|
24
26
|
end
|
|
25
27
|
|
|
26
28
|
def curry(*args)
|
|
27
|
-
new(rules.map { |rule| rule.curry(*args) }, options)
|
|
29
|
+
new(rules.map { |rule| rule.curry(*args) }, **options)
|
|
28
30
|
end
|
|
29
31
|
|
|
30
32
|
def new(rules, **new_options)
|
|
31
|
-
self.class.new(*rules, options
|
|
33
|
+
self.class.new(*rules, **options, **new_options)
|
|
32
34
|
end
|
|
33
35
|
|
|
34
36
|
def with(new_options)
|
|
35
|
-
new(rules, options
|
|
37
|
+
new(rules, **options, **new_options)
|
|
36
38
|
end
|
|
37
39
|
|
|
38
40
|
def to_ast
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'dry/logic/operations/binary'
|
|
2
4
|
require 'dry/logic/result'
|
|
3
5
|
|
|
@@ -7,7 +9,7 @@ module Dry
|
|
|
7
9
|
class And < Binary
|
|
8
10
|
attr_reader :hints
|
|
9
11
|
|
|
10
|
-
def initialize(
|
|
12
|
+
def initialize(*, **)
|
|
11
13
|
super
|
|
12
14
|
@hints = options.fetch(:hints, true)
|
|
13
15
|
end
|