dry-logic 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 533217afefb65476ef9ae53cb7fa4e9bf7e2183f35cc2193e92f38cc32a5a13b
4
- data.tar.gz: dd71ce645d5fead9128ecb82ed73dfc4f3070b76ff4c074688d419cf2d05fd79
3
+ metadata.gz: 58ce7aca14ea687be3852f8f6359ea33de4da0f057091127f828dbb2e6db8856
4
+ data.tar.gz: 283cf7ff61520f4ca1822bea434bd9b98ccb07c10e17f628e0f440029ca76092
5
5
  SHA512:
6
- metadata.gz: 189d109a8deb3e201b74a710c345ad76785875957d620b458c4569ce4e12eceb2039442fa6d77182403f72b4d6cc06899e20d2abf5d773f6acabc61f09167d9b
7
- data.tar.gz: 04e8a2bd77150f1d88a6fb39c59dfc3967f212bdce45e785b81176453bde161db7a3222cf61632c04337ff601c3c89a74125a1649700fa64c402f4943cb2d3d9
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
 
@@ -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.4.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.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-04 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