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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +129 -26
- data/LICENSE +1 -1
- data/README.md +12 -14
- data/dry-logic.gemspec +27 -14
- data/lib/dry-logic.rb +1 -1
- data/lib/dry/logic.rb +2 -2
- data/lib/dry/logic/evaluator.rb +1 -1
- data/lib/dry/logic/operations.rb +11 -11
- data/lib/dry/logic/operations/abstract.rb +6 -6
- data/lib/dry/logic/operations/and.rb +4 -4
- data/lib/dry/logic/operations/attr.rb +1 -1
- data/lib/dry/logic/operations/binary.rb +1 -1
- data/lib/dry/logic/operations/check.rb +4 -4
- data/lib/dry/logic/operations/each.rb +2 -2
- data/lib/dry/logic/operations/implication.rb +2 -2
- data/lib/dry/logic/operations/key.rb +5 -5
- data/lib/dry/logic/operations/negation.rb +2 -2
- data/lib/dry/logic/operations/or.rb +2 -2
- data/lib/dry/logic/operations/set.rb +3 -3
- data/lib/dry/logic/operations/unary.rb +1 -1
- data/lib/dry/logic/operations/xor.rb +2 -2
- data/lib/dry/logic/operators.rb +4 -4
- data/lib/dry/logic/predicates.rb +60 -28
- data/lib/dry/logic/result.rb +2 -2
- data/lib/dry/logic/rule.rb +11 -11
- data/lib/dry/logic/rule/interface.rb +32 -37
- data/lib/dry/logic/rule/predicate.rb +3 -3
- data/lib/dry/logic/rule_compiler.rb +3 -3
- data/lib/dry/logic/version.rb +1 -1
- metadata +12 -133
- 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 -15
- data/Rakefile +0 -14
- data/benchmarks/rule_application.rb +0 -30
- data/benchmarks/setup.rb +0 -13
- data/bin/console +0 -11
- data/examples/basic.rb +0 -16
- data/spec/integration/result_spec.rb +0 -61
- data/spec/integration/rule_spec.rb +0 -55
- data/spec/shared/predicates.rb +0 -59
- data/spec/shared/rule.rb +0 -74
- data/spec/spec_helper.rb +0 -36
- data/spec/support/mutant.rb +0 -11
- data/spec/unit/operations/and_spec.rb +0 -70
- data/spec/unit/operations/attr_spec.rb +0 -29
- data/spec/unit/operations/check_spec.rb +0 -51
- data/spec/unit/operations/each_spec.rb +0 -49
- data/spec/unit/operations/implication_spec.rb +0 -32
- data/spec/unit/operations/key_spec.rb +0 -135
- data/spec/unit/operations/negation_spec.rb +0 -51
- data/spec/unit/operations/or_spec.rb +0 -75
- data/spec/unit/operations/set_spec.rb +0 -43
- data/spec/unit/operations/xor_spec.rb +0 -63
- data/spec/unit/predicates/array_spec.rb +0 -43
- data/spec/unit/predicates/attr_spec.rb +0 -31
- data/spec/unit/predicates/bool_spec.rb +0 -36
- data/spec/unit/predicates/case_spec.rb +0 -35
- data/spec/unit/predicates/date_spec.rb +0 -33
- data/spec/unit/predicates/date_time_spec.rb +0 -33
- data/spec/unit/predicates/decimal_spec.rb +0 -34
- data/spec/unit/predicates/empty_spec.rb +0 -40
- data/spec/unit/predicates/eql_spec.rb +0 -23
- data/spec/unit/predicates/even_spec.rb +0 -33
- data/spec/unit/predicates/excluded_from_spec.rb +0 -37
- data/spec/unit/predicates/excludes_spec.rb +0 -58
- data/spec/unit/predicates/false_spec.rb +0 -37
- data/spec/unit/predicates/filled_spec.rb +0 -40
- data/spec/unit/predicates/float_spec.rb +0 -33
- data/spec/unit/predicates/format_spec.rb +0 -23
- data/spec/unit/predicates/gt_spec.rb +0 -42
- data/spec/unit/predicates/gteq_spec.rb +0 -42
- data/spec/unit/predicates/included_in_spec.rb +0 -37
- data/spec/unit/predicates/includes_spec.rb +0 -24
- data/spec/unit/predicates/int_spec.rb +0 -36
- data/spec/unit/predicates/key_spec.rb +0 -31
- data/spec/unit/predicates/lt_spec.rb +0 -42
- data/spec/unit/predicates/lteq_spec.rb +0 -42
- data/spec/unit/predicates/max_size_spec.rb +0 -51
- data/spec/unit/predicates/min_size_spec.rb +0 -51
- data/spec/unit/predicates/none_spec.rb +0 -30
- data/spec/unit/predicates/not_eql_spec.rb +0 -23
- data/spec/unit/predicates/number_spec.rb +0 -39
- data/spec/unit/predicates/odd_spec.rb +0 -33
- data/spec/unit/predicates/respond_to_spec.rb +0 -31
- data/spec/unit/predicates/size_spec.rb +0 -57
- data/spec/unit/predicates/str_spec.rb +0 -34
- data/spec/unit/predicates/time_spec.rb +0 -33
- data/spec/unit/predicates/true_spec.rb +0 -37
- data/spec/unit/predicates/type_spec.rb +0 -37
- data/spec/unit/predicates/uuid_v4_spec.rb +0 -29
- data/spec/unit/predicates_spec.rb +0 -25
- data/spec/unit/rule/predicate_spec.rb +0 -55
- data/spec/unit/rule_compiler_spec.rb +0 -129
- data/spec/unit/rule_spec.rb +0 -213
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18fd19e7ba009817c12de16b828fb0e1dd04f1e5d2305fa9eeb8be9a55681473
|
4
|
+
data.tar.gz: a4f2ff3297ab4684323489bd0a371f759b1b99d0a5c5f5425a3158f4d8af45e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c57af697d43afe951a6cfdce3a9afd2ce12399b95e6d48f9468c84a2de33299d8a20b8f1851652a86cb922868974b2be80f434d38c8086022db42d9baa7df5dc
|
7
|
+
data.tar.gz: a33e8cfcec95668d7189ac1921bce8c88602dd25fea59f10174cef42ff7130cd9bb4285884d4c241eeb98fcd842a5268078c14649851e1b24fc20a56633fcd43
|
data/CHANGELOG.md
CHANGED
@@ -1,39 +1,122 @@
|
|
1
|
-
|
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
|
-
|
86
|
+
## 1.0.0 2019-04-23
|
11
87
|
|
12
|
-
# v1.0.0 2019-04-23
|
13
88
|
|
14
|
-
|
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
|
-
|
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
|
-
|
105
|
+
## 0.6.0 2019-04-04
|
106
|
+
|
25
107
|
|
26
108
|
### Added
|
27
109
|
|
28
|
-
|
110
|
+
- Generating hints can be disabled by building `Operations::And` with `hints: false` option set (solnic)
|
29
111
|
|
30
112
|
### Changed
|
31
113
|
|
32
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
293
|
+
## 0.1.0 2016-01-11
|
191
294
|
|
192
295
|
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,25 +1,38 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
# this file is managed by dry-rb/devtools project
|
2
3
|
|
3
|
-
|
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.
|
8
|
-
spec.
|
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.
|
15
|
-
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 = []
|
16
21
|
spec.require_paths = ['lib']
|
17
22
|
|
18
|
-
spec.
|
19
|
-
spec.
|
20
|
-
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'
|
21
27
|
|
22
|
-
spec.
|
23
|
-
|
24
|
-
|
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
|
data/lib/dry-logic.rb
CHANGED
data/lib/dry/logic.rb
CHANGED
data/lib/dry/logic/evaluator.rb
CHANGED
data/lib/dry/logic/operations.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
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
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
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
|
15
|
+
require "dry/logic/operators"
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
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
|
33
|
+
self.class.new(*rules, **options, **new_options)
|
34
34
|
end
|
35
35
|
|
36
36
|
def with(new_options)
|
37
|
-
new(rules, options
|
37
|
+
new(rules, **options, **new_options)
|
38
38
|
end
|
39
39
|
|
40
40
|
def to_ast
|