dry-logic 1.0.0 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +117 -24
  3. data/LICENSE +1 -1
  4. data/README.md +12 -14
  5. data/dry-logic.gemspec +29 -14
  6. data/lib/dry-logic.rb +2 -0
  7. data/lib/dry/logic.rb +2 -0
  8. data/lib/dry/logic/appliable.rb +2 -0
  9. data/lib/dry/logic/evaluator.rb +2 -0
  10. data/lib/dry/logic/operations.rb +2 -0
  11. data/lib/dry/logic/operations/abstract.rb +5 -3
  12. data/lib/dry/logic/operations/and.rb +3 -1
  13. data/lib/dry/logic/operations/attr.rb +2 -0
  14. data/lib/dry/logic/operations/binary.rb +2 -0
  15. data/lib/dry/logic/operations/check.rb +3 -1
  16. data/lib/dry/logic/operations/each.rb +2 -0
  17. data/lib/dry/logic/operations/implication.rb +2 -0
  18. data/lib/dry/logic/operations/key.rb +4 -2
  19. data/lib/dry/logic/operations/negation.rb +2 -0
  20. data/lib/dry/logic/operations/or.rb +2 -0
  21. data/lib/dry/logic/operations/set.rb +2 -0
  22. data/lib/dry/logic/operations/unary.rb +2 -0
  23. data/lib/dry/logic/operations/xor.rb +2 -0
  24. data/lib/dry/logic/operators.rb +2 -0
  25. data/lib/dry/logic/predicates.rb +39 -21
  26. data/lib/dry/logic/result.rb +2 -0
  27. data/lib/dry/logic/rule.rb +5 -3
  28. data/lib/dry/logic/rule/interface.rb +3 -1
  29. data/lib/dry/logic/rule/predicate.rb +2 -0
  30. data/lib/dry/logic/rule_compiler.rb +2 -0
  31. data/lib/dry/logic/version.rb +3 -1
  32. metadata +11 -128
  33. data/.codeclimate.yml +0 -15
  34. data/.gitignore +0 -9
  35. data/.rspec +0 -3
  36. data/.travis.yml +0 -31
  37. data/CONTRIBUTING.md +0 -29
  38. data/Gemfile +0 -13
  39. data/Rakefile +0 -12
  40. data/benchmarks/rule_application.rb +0 -28
  41. data/benchmarks/setup.rb +0 -11
  42. data/bin/console +0 -10
  43. data/examples/basic.rb +0 -14
  44. data/spec/integration/result_spec.rb +0 -59
  45. data/spec/integration/rule_spec.rb +0 -53
  46. data/spec/shared/predicates.rb +0 -57
  47. data/spec/shared/rule.rb +0 -72
  48. data/spec/spec_helper.rb +0 -34
  49. data/spec/support/mutant.rb +0 -9
  50. data/spec/unit/operations/and_spec.rb +0 -68
  51. data/spec/unit/operations/attr_spec.rb +0 -27
  52. data/spec/unit/operations/check_spec.rb +0 -49
  53. data/spec/unit/operations/each_spec.rb +0 -47
  54. data/spec/unit/operations/implication_spec.rb +0 -30
  55. data/spec/unit/operations/key_spec.rb +0 -133
  56. data/spec/unit/operations/negation_spec.rb +0 -49
  57. data/spec/unit/operations/or_spec.rb +0 -73
  58. data/spec/unit/operations/set_spec.rb +0 -41
  59. data/spec/unit/operations/xor_spec.rb +0 -61
  60. data/spec/unit/predicates/array_spec.rb +0 -41
  61. data/spec/unit/predicates/attr_spec.rb +0 -29
  62. data/spec/unit/predicates/bool_spec.rb +0 -34
  63. data/spec/unit/predicates/case_spec.rb +0 -33
  64. data/spec/unit/predicates/date_spec.rb +0 -31
  65. data/spec/unit/predicates/date_time_spec.rb +0 -31
  66. data/spec/unit/predicates/decimal_spec.rb +0 -32
  67. data/spec/unit/predicates/empty_spec.rb +0 -38
  68. data/spec/unit/predicates/eql_spec.rb +0 -21
  69. data/spec/unit/predicates/even_spec.rb +0 -31
  70. data/spec/unit/predicates/excluded_from_spec.rb +0 -35
  71. data/spec/unit/predicates/excludes_spec.rb +0 -56
  72. data/spec/unit/predicates/false_spec.rb +0 -35
  73. data/spec/unit/predicates/filled_spec.rb +0 -38
  74. data/spec/unit/predicates/float_spec.rb +0 -31
  75. data/spec/unit/predicates/format_spec.rb +0 -21
  76. data/spec/unit/predicates/gt_spec.rb +0 -40
  77. data/spec/unit/predicates/gteq_spec.rb +0 -40
  78. data/spec/unit/predicates/included_in_spec.rb +0 -35
  79. data/spec/unit/predicates/includes_spec.rb +0 -24
  80. data/spec/unit/predicates/int_spec.rb +0 -34
  81. data/spec/unit/predicates/key_spec.rb +0 -29
  82. data/spec/unit/predicates/lt_spec.rb +0 -40
  83. data/spec/unit/predicates/lteq_spec.rb +0 -40
  84. data/spec/unit/predicates/max_size_spec.rb +0 -49
  85. data/spec/unit/predicates/min_size_spec.rb +0 -49
  86. data/spec/unit/predicates/none_spec.rb +0 -28
  87. data/spec/unit/predicates/not_eql_spec.rb +0 -21
  88. data/spec/unit/predicates/number_spec.rb +0 -37
  89. data/spec/unit/predicates/odd_spec.rb +0 -31
  90. data/spec/unit/predicates/size_spec.rb +0 -55
  91. data/spec/unit/predicates/str_spec.rb +0 -32
  92. data/spec/unit/predicates/time_spec.rb +0 -31
  93. data/spec/unit/predicates/true_spec.rb +0 -35
  94. data/spec/unit/predicates/type_spec.rb +0 -35
  95. data/spec/unit/predicates_spec.rb +0 -23
  96. data/spec/unit/rule/predicate_spec.rb +0 -53
  97. data/spec/unit/rule_compiler_spec.rb +0 -127
  98. data/spec/unit/rule_spec.rb +0 -211
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc0793c95681757b6d069c1d7c6bc59278457069edac35f329845dc283e69c22
4
- data.tar.gz: e46cd2a8f4e03c78778f35e51a3c616a2dc32881eb703aa6b441da1d34603733
3
+ metadata.gz: a6c0b350baaf47853027db9d61e790c195ced412ff40a9ecaac56b6588172da3
4
+ data.tar.gz: 966f1daee610a4eea2eae78743e8e17f0e57084b1106fd3f033483329895a4a1
5
5
  SHA512:
6
- metadata.gz: 732504942a364347befcdc7bee439777a0fd60b470b288cd793d9a21835ff13cc5399b2b6fd514ca0d586708fe044acd664dc2403b6a6a821851b4183533f494
7
- data.tar.gz: 811ba73afd3bc3f0bb13511ca69fa6af54a24638a7dc02cbc867df7529a276ed7b559c4cae7863b8b21a529b2095f8bbfc33eb027ea6f80e1d29076656cf13de
6
+ metadata.gz: 98002481f3e8cc83affa67ff7b3f8e69b22836f0737112bba1d4c656f39cbc06d9657bdb7865326fb9b6531660a9fd260b60d18d2062d9d149a97f25154a3974
7
+ data.tar.gz: cc6163b44e7e2ef296901e35085fa42290ad8b4b936237e26409f7f71d90041e12472322319d3dc8553fb46dcf532b2747b68b1d3a5cd46e81bb94fb298cf56c
data/CHANGELOG.md CHANGED
@@ -1,28 +1,101 @@
1
- # v1.0.0 2019-04-23
1
+ ## 1.0.6 2020-02-10
2
2
 
3
- Version bump to 1.0.0
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
- # v0.6.1 2019-04-18
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
- # v0.6.0 2019-04-04
84
+ ## 0.6.0 2019-04-04
85
+
14
86
 
15
87
  ### Added
16
88
 
17
- * Generating hints can be disabled by building `Operations::And` with `hints: false` option set (solnic)
89
+ - Generating hints can be disabled by building `Operations::And` with `hints: false` option set (solnic)
18
90
 
19
91
  ### Changed
20
92
 
21
- * `Rule` construction has been optimized so that currying and application is multiple-times faster (flash-gordon)
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
- # v0.5.0 2019-01-29
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
- # v0.4.2 2017-09-15
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
- # v0.4.1 2017-01-23
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
- ### Changed
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
- # v0.4.0 2016-09-21
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
- # v0.3.0 2016-07-01
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
- # v0.2.3 2016-05-11
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
- # v0.2.2 2016-03-30
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
- # v0.2.1 2016-03-20
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
- # v0.2.0 2016-03-11
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
- # v0.1.4 2016-01-27
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
- # v0.1.3 2016-01-27
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
- # v0.1.2 2016-01-19
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
- # v0.1.1 2016-01-18
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
- # v0.1.0 2016-01-11
272
+ ## 0.1.0 2016-01-11
180
273
 
181
274
  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
 
data/dry-logic.gemspec CHANGED
@@ -1,23 +1,38 @@
1
- require File.expand_path('../lib/dry/logic/version', __FILE__)
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.version = Dry::Logic::VERSION
6
- spec.authors = ['Piotr Solnica']
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.files = `git ls-files -z`.split("\x0")
13
- 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 = []
14
21
  spec.require_paths = ['lib']
15
22
 
16
- spec.add_runtime_dependency 'concurrent-ruby', '~> 1.0'
17
- spec.add_runtime_dependency 'dry-core', '~> 0.2'
18
- 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'
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 'bundler'
21
- spec.add_development_dependency 'rake'
22
- spec.add_development_dependency 'rspec'
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
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry/logic'
data/lib/dry/logic.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # A collection of micro-libraries, each intended to encapsulate
2
4
  # a common task in Ruby
3
5
  module Dry
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dry
2
4
  module Logic
3
5
  module Appliable
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry/equalizer'
2
4
 
3
5
  module Dry
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry/logic/operations/and'
2
4
  require 'dry/logic/operations/or'
3
5
  require 'dry/logic/operations/xor'
@@ -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.merge(new_options))
33
+ self.class.new(*rules, **options, **new_options)
32
34
  end
33
35
 
34
36
  def with(new_options)
35
- new(rules, options.merge(new_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