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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9302f3c5ad02f81c99c8e873eb0b4e7ecc4c8fd2c7f964590f6f39db4f509ee
4
- data.tar.gz: 13799ef7e9224fd519eec2b902224f9f84002dd1647f77a9584e2e4305e15e47
3
+ metadata.gz: 58ce7aca14ea687be3852f8f6359ea33de4da0f057091127f828dbb2e6db8856
4
+ data.tar.gz: 283cf7ff61520f4ca1822bea434bd9b98ccb07c10e17f628e0f440029ca76092
5
5
  SHA512:
6
- metadata.gz: f16154529f4b4c74bc8e4551d147422da5e09c04981bea3b4bfafb4a5356661e2ea39fee2ff84994d9e9a886b157a92e422b6581300f755518f156f018d87372
7
- data.tar.gz: b72cc11b159301e3ca7c2a6f0df47d8d4cc44cf3986ab931614fb2e688500c8a3437192b8bf34a0f4a976d1e18f61adcb10fe3cdbd414b20305fbbe7d6d7f1f6
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
- ## unreleased
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
- - Deprecate `eql?` in favor of `is_eql?` (issue #92 via #98) (@solnic)
13
- - Deprecate `respond_to?` in favor of `interface?` (issue #73 closed via #99) (@solnic)
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.3.0...master](https://github.com/dry-rb/dry-logic/compare/v1.3.0...master)
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 [![Join the chat at https://dry-rb.zulipchat.com](https://img.shields.io/badge/dry--rb-join%20chat-%23346b7a.svg)][chat]
9
-
10
- [![Gem Version](https://badge.fury.io/rb/dry-logic.svg)][gem]
11
- [![CI Status](https://github.com/dry-rb/dry-logic/workflows/ci/badge.svg)][actions]
12
- [![Codacy Badge](https://api.codacy.com/project/badge/Grade/3ac6ea12c2dd42beb36dc3abe63d9606)][codacy]
13
- [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/3ac6ea12c2dd42beb36dc3abe63d9606)][codacy]
14
- [![Inline docs](http://inch-ci.org/github/dry-rb/dry-logic.svg?branch=main)][inchpages]
5
+ # dry-logic [![Gem Version](https://badge.fury.io/rb/dry-logic.svg)][gem] [![CI Status](https://github.com/dry-rb/dry-logic/workflows/ci/badge.svg)][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.9", ">= 0.9"
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"
@@ -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
- ::Kernel.warn "inclusion is deprecated - use included_in instead."
171
+ deprecated(:inclusion?, :included_in?)
168
172
  included_in?(list, input)
169
173
  end
170
174
 
171
175
  def exclusion?(list, input)
172
- ::Kernel.warn "exclusion is deprecated - use excluded_from instead."
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
- def eql?(left, right)
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
- def respond_to?(method, input)
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Logic
5
- VERSION = "1.3.0"
5
+ VERSION = "1.5.0"
6
6
  end
7
7
  end
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.3.0
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-10-15 00:00:00.000000000 Z
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.9'
34
- - - ">="
33
+ version: '1.0'
34
+ - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: '0.9'
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.9'
44
- - - ">="
43
+ version: '1.0'
44
+ - - "<"
45
45
  - !ruby/object:Gem::Version
46
- version: '0.9'
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.3.7
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: []