dry-logic 1.3.0 → 1.5.0
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 +13 -4
- data/README.md +2 -10
- data/dry-logic.gemspec +1 -1
- data/lib/dry/logic/predicates.rb +24 -4
- data/lib/dry/logic/version.rb +1 -1
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58ce7aca14ea687be3852f8f6359ea33de4da0f057091127f828dbb2e6db8856
|
4
|
+
data.tar.gz: 283cf7ff61520f4ca1822bea434bd9b98ccb07c10e17f628e0f440029ca76092
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d16672e062a05eb7c79a5ce34f47307b8eb7cba7cefce4c39d513f835b59fd711968e5bccb8a5f6e7c125aeec6485a4ff9193cc046390c44e2f4f4090f3ad44
|
7
|
+
data.tar.gz: 4fbe122584b52eda9d699726023c09fcc9e636f8f67d3670de584b0a7d6345ebdac17ea7173bfa753aab35500eeb8f95d9941b851c980cd6fcac5c3cac8d879d
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
|
2
2
|
|
3
|
-
##
|
3
|
+
## 1.5.0 2022-11-24
|
4
4
|
|
5
5
|
|
6
6
|
### Added
|
@@ -9,10 +9,19 @@
|
|
9
9
|
|
10
10
|
### Changed
|
11
11
|
|
12
|
-
-
|
13
|
-
-
|
12
|
+
- Made `Predicates.respond_to?` compatible with `Object#respond_to?` (via #105) (@solnic)
|
13
|
+
- Made `Predicates.eql?` compatible with `Object#eql?` (via #106) (@solnic)
|
14
14
|
|
15
|
-
[Compare v1.
|
15
|
+
[Compare v1.4.0...v1.5.0](https://github.com/dry-rb/dry-logic/compare/v1.4.0...v1.5.0)
|
16
|
+
|
17
|
+
## 1.4.0 2022-11-04
|
18
|
+
|
19
|
+
|
20
|
+
### Changed
|
21
|
+
|
22
|
+
- Updated to dry-core 1.0 (@flash-gordon + @solnic)
|
23
|
+
|
24
|
+
[Compare v1.3.0...v1.4.0](https://github.com/dry-rb/dry-logic/compare/v1.3.0...v1.4.0)
|
16
25
|
|
17
26
|
## 1.3.0 2022-10-15
|
18
27
|
|
data/README.md
CHANGED
@@ -1,22 +1,14 @@
|
|
1
1
|
<!--- this file is synced from dry-rb/template-gem project -->
|
2
2
|
[gem]: https://rubygems.org/gems/dry-logic
|
3
3
|
[actions]: https://github.com/dry-rb/dry-logic/actions
|
4
|
-
[codacy]: https://www.codacy.com/gh/dry-rb/dry-logic
|
5
|
-
[chat]: https://dry-rb.zulipchat.com
|
6
|
-
[inchpages]: http://inch-ci.org/github/dry-rb/dry-logic
|
7
4
|
|
8
|
-
# dry-logic [][gem]
|
11
|
-
[][actions]
|
12
|
-
[][codacy]
|
13
|
-
[][codacy]
|
14
|
-
[][inchpages]
|
5
|
+
# dry-logic [][gem] [][actions]
|
15
6
|
|
16
7
|
## Links
|
17
8
|
|
18
9
|
* [User documentation](https://dry-rb.org/gems/dry-logic)
|
19
10
|
* [API documentation](http://rubydoc.info/gems/dry-logic)
|
11
|
+
* [Forum](https://discourse.dry-rb.org)
|
20
12
|
|
21
13
|
## Supported Ruby versions
|
22
14
|
|
data/dry-logic.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
|
31
31
|
# to update dependencies edit project.yml
|
32
32
|
spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
|
33
|
-
spec.add_runtime_dependency "dry-core", "~> 0
|
33
|
+
spec.add_runtime_dependency "dry-core", "~> 1.0", "< 2"
|
34
34
|
spec.add_runtime_dependency "zeitwerk", "~> 2.6"
|
35
35
|
|
36
36
|
spec.add_development_dependency "bundler"
|
data/lib/dry/logic/predicates.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "dry/core/constants"
|
4
|
+
|
3
5
|
require "bigdecimal"
|
4
6
|
require "bigdecimal/util"
|
5
7
|
require "date"
|
@@ -7,6 +9,8 @@ require "date"
|
|
7
9
|
module Dry
|
8
10
|
module Logic
|
9
11
|
module Predicates
|
12
|
+
include Dry::Core::Constants
|
13
|
+
|
10
14
|
# rubocop:disable Metrics/ModuleLength
|
11
15
|
module Methods
|
12
16
|
def self.uuid_format(version)
|
@@ -164,12 +168,12 @@ module Dry
|
|
164
168
|
end
|
165
169
|
|
166
170
|
def inclusion?(list, input)
|
167
|
-
|
171
|
+
deprecated(:inclusion?, :included_in?)
|
168
172
|
included_in?(list, input)
|
169
173
|
end
|
170
174
|
|
171
175
|
def exclusion?(list, input)
|
172
|
-
|
176
|
+
deprecated(:exclusion?, :excluded_from?)
|
173
177
|
excluded_from?(list, input)
|
174
178
|
end
|
175
179
|
|
@@ -195,7 +199,10 @@ module Dry
|
|
195
199
|
!includes?(value, input)
|
196
200
|
end
|
197
201
|
|
198
|
-
|
202
|
+
# This overrides Object#eql? so we need to make it compatible
|
203
|
+
def eql?(left, right = Undefined)
|
204
|
+
return super(left) if right.equal?(Undefined)
|
205
|
+
|
199
206
|
left.eql?(right)
|
200
207
|
end
|
201
208
|
|
@@ -254,13 +261,26 @@ module Dry
|
|
254
261
|
format?(URI::RFC3986_Parser::RFC3986_URI, input)
|
255
262
|
end
|
256
263
|
|
257
|
-
|
264
|
+
# This overrides Object#respond_to? so we need to make it compatible
|
265
|
+
def respond_to?(method, input = Undefined)
|
266
|
+
return super if input.equal?(Undefined)
|
267
|
+
|
258
268
|
input.respond_to?(method)
|
259
269
|
end
|
260
270
|
|
261
271
|
def predicate(name, &block)
|
262
272
|
define_singleton_method(name, &block)
|
263
273
|
end
|
274
|
+
|
275
|
+
def deprecated(name, in_favor_of)
|
276
|
+
Core::Deprecations.warn(
|
277
|
+
"#{name} predicate is deprecated and will " \
|
278
|
+
"be removed in the next major version\n" \
|
279
|
+
"Please use #{in_favor_of} predicate instead",
|
280
|
+
tag: "dry-logic",
|
281
|
+
uplevel: 3
|
282
|
+
)
|
283
|
+
end
|
264
284
|
end
|
265
285
|
|
266
286
|
extend Methods
|
data/lib/dry/logic/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-logic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -30,20 +30,20 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0
|
34
|
-
- - "
|
33
|
+
version: '1.0'
|
34
|
+
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
36
|
+
version: '2'
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - "~>"
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '0
|
44
|
-
- - "
|
43
|
+
version: '1.0'
|
44
|
+
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '2'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: zeitwerk
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -145,7 +145,7 @@ metadata:
|
|
145
145
|
changelog_uri: https://github.com/dry-rb/dry-logic/blob/main/CHANGELOG.md
|
146
146
|
source_code_uri: https://github.com/dry-rb/dry-logic
|
147
147
|
bug_tracker_uri: https://github.com/dry-rb/dry-logic/issues
|
148
|
-
post_install_message:
|
148
|
+
post_install_message:
|
149
149
|
rdoc_options: []
|
150
150
|
require_paths:
|
151
151
|
- lib
|
@@ -160,8 +160,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
160
|
- !ruby/object:Gem::Version
|
161
161
|
version: '0'
|
162
162
|
requirements: []
|
163
|
-
rubygems_version: 3.
|
164
|
-
signing_key:
|
163
|
+
rubygems_version: 3.1.6
|
164
|
+
signing_key:
|
165
165
|
specification_version: 4
|
166
166
|
summary: Predicate logic with rule composition
|
167
167
|
test_files: []
|