dry-logic 1.0.2 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +119 -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 +8 -8
- 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: 828bea190b3733a29b940d0fa6bbb1270bb12ee6bbbef77d1ce6bbfd7ff11a27
|
4
|
+
data.tar.gz: 319087e0aa57490d3a0bbff76efd6b01119a55135de7dbe0829d64cfee604d82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e3d3d3d7c486aec5e4c01ebc15f90ba485dfe4d10086c11a732ea3ffac5749de02b4ecc0fb0beafe8bcc593fa07286c1c8c30f2973baaf70598a3f212e949eb
|
7
|
+
data.tar.gz: beb0445b376e9e8f545615d69af4c7cc1ad76db1ac55de9bd54784d8ff914165afec81ce174843efac5cffeda8bba494bca9e686d75052f00dee87abbfef03b3
|
data/CHANGELOG.md
CHANGED
@@ -1,39 +1,112 @@
|
|
1
|
-
|
1
|
+
## 1.0.7 2020-08-13
|
2
|
+
|
3
|
+
|
4
|
+
### Added
|
5
|
+
|
6
|
+
- A new `uri?` predicate that you can use to verify `URI` strings, ie `uri?("https", "https://dry-rb.org")` (@nerburish)
|
7
|
+
- New predicates: `uuid_v1?`, `uuid_v2?`, `uuid_v3?` and `uuid_v5?` (via #75) (@jamesbrauman)
|
8
|
+
|
9
|
+
|
10
|
+
[Compare v1.0.6...v1.0.7](https://github.com/dry-rb/dry-logic/compare/v1.0.6...v1.0.7)
|
11
|
+
|
12
|
+
## 1.0.6 2020-02-10
|
13
|
+
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
|
17
|
+
- Made the regexp used by `uuid_v4?` more secure (@kml)
|
18
|
+
|
19
|
+
|
20
|
+
[Compare v1.0.5...v1.0.6](https://github.com/dry-rb/dry-logic/compare/v1.0.5...v1.0.6)
|
21
|
+
|
22
|
+
## 1.0.5 2019-11-07
|
23
|
+
|
24
|
+
|
25
|
+
### Fixed
|
26
|
+
|
27
|
+
- 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)
|
28
|
+
|
29
|
+
|
30
|
+
[Compare v1.0.4...v1.0.5](https://github.com/dry-rb/dry-logic/compare/v1.0.4...v1.0.5)
|
31
|
+
|
32
|
+
## 1.0.4 2019-11-06
|
33
|
+
|
34
|
+
|
35
|
+
### Fixed
|
36
|
+
|
37
|
+
- Fix keyword warnings (@flash-gordon)
|
38
|
+
|
39
|
+
|
40
|
+
[Compare v1.0.3...v1.0.4](https://github.com/dry-rb/dry-logic/compare/v1.0.3...v1.0.4)
|
41
|
+
|
42
|
+
## 1.0.3 2019-08-01
|
43
|
+
|
44
|
+
|
45
|
+
### Added
|
46
|
+
|
47
|
+
- `bytesize?` predicate (@bmalinconico)
|
48
|
+
- `min_bytesize?` predicate (@bmalinconico)
|
49
|
+
- `max_bytesize? predicate (@bmalinconico)
|
50
|
+
|
51
|
+
### Changed
|
52
|
+
|
53
|
+
- Min ruby version was set to `>= 2.4.0` (@flash-gordon)
|
54
|
+
|
55
|
+
[Compare v1.0.2...v1.0.3](https://github.com/dry-rb/dry-logic/compare/v1.0.2...v1.0.3)
|
56
|
+
|
57
|
+
## 1.0.2 2019-06-14
|
58
|
+
|
59
|
+
Re-pushed 1.0.1 after dry-schema 1.2.0 release.
|
60
|
+
|
61
|
+
|
62
|
+
[Compare v1.0.1...v1.0.2](https://github.com/dry-rb/dry-logic/compare/v1.0.1...v1.0.2)
|
63
|
+
|
64
|
+
## 1.0.1 2019-06-04
|
65
|
+
|
66
|
+
This release was removed from rubygems because it broke dry-schema.
|
2
67
|
|
3
68
|
### Added
|
4
69
|
|
5
70
|
- `uuid_v4?` predicate (radar)
|
6
71
|
- `respond_to?` predicate (waiting-for-dev)
|
7
72
|
|
73
|
+
|
8
74
|
[Compare v1.0.0...v1.0.1](https://github.com/dry-rb/dry-logic/compare/v1.0.0...v1.0.1)
|
9
75
|
|
10
|
-
|
76
|
+
## 1.0.0 2019-04-23
|
77
|
+
|
11
78
|
|
12
|
-
|
79
|
+
### Changed
|
13
80
|
|
14
|
-
|
81
|
+
- Version bump to `1.0.0` (flash-gordon)
|
15
82
|
|
16
83
|
[Compare v0.6.1...v1.0.0](https://github.com/dry-rb/dry-logic/compare/v0.6.1...v1.0.0)
|
17
84
|
|
18
|
-
|
85
|
+
## 0.6.1 2019-04-18
|
86
|
+
|
87
|
+
|
88
|
+
### Fixed
|
89
|
+
|
90
|
+
- Fix a regression in dry-validation 0.x for argument-less predicates (flash-gordon)
|
19
91
|
|
20
|
-
* Fix a regression in dry-validation 0.x for argument-less predicates (flash-gordon)
|
21
92
|
|
22
93
|
[Compare v0.6.0...v0.6.1](https://github.com/dry-rb/dry-logic/compare/v0.6.0...v0.6.1)
|
23
94
|
|
24
|
-
|
95
|
+
## 0.6.0 2019-04-04
|
96
|
+
|
25
97
|
|
26
98
|
### Added
|
27
99
|
|
28
|
-
|
100
|
+
- Generating hints can be disabled by building `Operations::And` with `hints: false` option set (solnic)
|
29
101
|
|
30
102
|
### Changed
|
31
103
|
|
32
|
-
|
104
|
+
- `Rule` construction has been optimized so that currying and application is multiple-times faster (flash-gordon)
|
33
105
|
|
34
106
|
[Compare v0.5.0...v0.6.0](https://github.com/dry-rb/dry-logic/compare/v0.5.0...v0.6.0)
|
35
107
|
|
36
|
-
|
108
|
+
## 0.5.0 2019-01-29
|
109
|
+
|
37
110
|
|
38
111
|
### Added
|
39
112
|
|
@@ -43,9 +116,11 @@ This release was removed from rubygems because it broke dry-schema.
|
|
43
116
|
|
44
117
|
- `Operation::Key#ast` will now return a correct AST with non-Undefined inputs (solnic)
|
45
118
|
|
119
|
+
|
46
120
|
[Compare v0.4.2...v0.5.0](https://github.com/dry-rb/dry-logic/compare/v0.4.2...v0.5.0)
|
47
121
|
|
48
|
-
|
122
|
+
## 0.4.2 2017-09-15
|
123
|
+
|
49
124
|
|
50
125
|
### Added
|
51
126
|
|
@@ -56,21 +131,23 @@ This release was removed from rubygems because it broke dry-schema.
|
|
56
131
|
|
57
132
|
- A bug with using custom predicates within a standalone module in `dry-validation` (flash-gordon)
|
58
133
|
|
134
|
+
|
59
135
|
[Compare v0.4.1...v0.4.2](https://github.com/dry-rb/dry-logic/compare/v0.4.1...v0.4.2)
|
60
136
|
|
61
|
-
|
137
|
+
## 0.4.1 2017-01-23
|
62
138
|
|
63
|
-
### Changed
|
64
|
-
|
65
|
-
- Predicates simply reuse other predicate methods instead of referring to them via `#[]` (georgemillo)
|
66
139
|
|
67
140
|
### Fixed
|
68
141
|
|
69
142
|
- Warnings on MRI 2.4.0 are gone (jtippett)
|
70
143
|
|
144
|
+
### Changed
|
145
|
+
|
146
|
+
- Predicates simply reuse other predicate methods instead of referring to them via `#[]` (georgemillo)
|
147
|
+
|
71
148
|
[Compare v0.4.0...v0.4.1](https://github.com/dry-rb/dry-logic/compare/v0.4.0...v0.4.1)
|
72
149
|
|
73
|
-
|
150
|
+
## 0.4.0 2016-09-21
|
74
151
|
|
75
152
|
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
153
|
|
@@ -98,7 +175,8 @@ This is a partial rewrite focused on internal clean up and major performance imp
|
|
98
175
|
|
99
176
|
[Compare v0.3.0...v0.4.0](https://github.com/dry-rb/dry-logic/compare/v0.3.0...v0.4.0)
|
100
177
|
|
101
|
-
|
178
|
+
## 0.3.0 2016-07-01
|
179
|
+
|
102
180
|
|
103
181
|
### Added
|
104
182
|
|
@@ -113,7 +191,8 @@ This is a partial rewrite focused on internal clean up and major performance imp
|
|
113
191
|
|
114
192
|
[Compare v0.2.3...v0.3.0](https://github.com/dry-rb/dry-logic/compare/v0.2.3...v0.3.0)
|
115
193
|
|
116
|
-
|
194
|
+
## 0.2.3 2016-05-11
|
195
|
+
|
117
196
|
|
118
197
|
### Added
|
119
198
|
|
@@ -126,21 +205,28 @@ This is a partial rewrite focused on internal clean up and major performance imp
|
|
126
205
|
|
127
206
|
[Compare v0.2.2...v0.2.3](https://github.com/dry-rb/dry-logic/compare/v0.2.2...v0.2.3)
|
128
207
|
|
129
|
-
|
208
|
+
## 0.2.2 2016-03-30
|
209
|
+
|
130
210
|
|
131
211
|
### Added
|
132
212
|
|
133
213
|
- `number?`, `odd?`, `even?` predicates (fran-worley)
|
134
214
|
|
215
|
+
|
135
216
|
[Compare v0.2.1...v0.2.2](https://github.com/dry-rb/dry-logic/compare/v0.2.1...v0.2.2)
|
136
217
|
|
137
|
-
|
218
|
+
## 0.2.1 2016-03-20
|
219
|
+
|
138
220
|
|
139
221
|
### Fixed
|
140
222
|
|
141
223
|
- Result AST for `Rule::Each` correctly maps elements with eql inputs (solnic)
|
142
224
|
|
143
|
-
|
225
|
+
|
226
|
+
[Compare v0.2.0...v0.2.1](https://github.com/dry-rb/dry-logic/compare/v0.2.0...v0.2.1)
|
227
|
+
|
228
|
+
## 0.2.0 2016-03-11
|
229
|
+
|
144
230
|
|
145
231
|
### Changed
|
146
232
|
|
@@ -148,16 +234,19 @@ This is a partial rewrite focused on internal clean up and major performance imp
|
|
148
234
|
|
149
235
|
[Compare v0.1.4...v0.2.0](https://github.com/dry-rb/dry-logic/compare/v0.1.4...v0.2.0)
|
150
236
|
|
151
|
-
|
237
|
+
## 0.1.4 2016-01-27
|
238
|
+
|
152
239
|
|
153
240
|
### Added
|
154
241
|
|
155
242
|
- Support for hash-names in `Check` and `Result` which can properly resolve input
|
156
243
|
from nested results (solnic)
|
157
244
|
|
245
|
+
|
158
246
|
[Compare v0.1.3...v0.1.4](https://github.com/dry-rb/dry-logic/compare/v0.1.3...v0.1.4)
|
159
247
|
|
160
|
-
|
248
|
+
## 0.1.3 2016-01-27
|
249
|
+
|
161
250
|
|
162
251
|
### Added
|
163
252
|
|
@@ -169,15 +258,18 @@ This is a partial rewrite focused on internal clean up and major performance imp
|
|
169
258
|
|
170
259
|
[Compare v0.1.2...v0.1.3](https://github.com/dry-rb/dry-logic/compare/v0.1.2...v0.1.3)
|
171
260
|
|
172
|
-
|
261
|
+
## 0.1.2 2016-01-19
|
262
|
+
|
173
263
|
|
174
264
|
### Fixed
|
175
265
|
|
176
266
|
- `xor` returns wrapped results when used against another result-rule (solnic)
|
177
267
|
|
268
|
+
|
178
269
|
[Compare v0.1.1...v0.1.2](https://github.com/dry-rb/dry-logic/compare/v0.1.1...v0.1.2)
|
179
270
|
|
180
|
-
|
271
|
+
## 0.1.1 2016-01-18
|
272
|
+
|
181
273
|
|
182
274
|
### Added
|
183
275
|
|
@@ -185,8 +277,9 @@ This is a partial rewrite focused on internal clean up and major performance imp
|
|
185
277
|
- `Rule::Result` which can be applied to a result object (solnic)
|
186
278
|
- `true?` and `false?` predicates (solnic)
|
187
279
|
|
280
|
+
|
188
281
|
[Compare v0.1.0...v0.1.1](https://github.com/dry-rb/dry-logic/compare/v0.1.0...v0.1.1)
|
189
282
|
|
190
|
-
|
283
|
+
## 0.1.0 2016-01-11
|
191
284
|
|
192
285
|
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 [![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
|
-
[![
|
11
|
-
[![
|
12
|
-
[![
|
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
|
-
* [
|
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
|