dry-logic 1.4.0 → 1.6.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: 533217afefb65476ef9ae53cb7fa4e9bf7e2183f35cc2193e92f38cc32a5a13b
4
- data.tar.gz: dd71ce645d5fead9128ecb82ed73dfc4f3070b76ff4c074688d419cf2d05fd79
3
+ metadata.gz: c1ad8dbf80a90343c1b903d8c56682b3b83ec02fbd40b96175598d011ca6e5fb
4
+ data.tar.gz: 1bdd6f06073b61dfaa843844c72a96408dcb8745b69ecfae99758da1b7876abc
5
5
  SHA512:
6
- metadata.gz: 189d109a8deb3e201b74a710c345ad76785875957d620b458c4569ce4e12eceb2039442fa6d77182403f72b4d6cc06899e20d2abf5d773f6acabc61f09167d9b
7
- data.tar.gz: 04e8a2bd77150f1d88a6fb39c59dfc3967f212bdce45e785b81176453bde161db7a3222cf61632c04337ff601c3c89a74125a1649700fa64c402f4943cb2d3d9
6
+ metadata.gz: b8f95362da176825e3dc22dac020ab008222980788abc472b7008b6fd9c98aae7f48a18c523b5f8194399e08fc271a457b8167438ad103faad8f6ebc7ae7a0c6
7
+ data.tar.gz: 06644cc140ae06bf5f9df176560a21aca0aa3f96ff250cabfe299c7864b7ed31c673576b68e035809645c4a24ccce6867c9232c50874da669dbe7c6c75189dbe
data/CHANGELOG.md CHANGED
@@ -1,6 +1,19 @@
1
1
  <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
2
 
3
- ## unreleased
3
+ ## 1.6.0 2025-01-04
4
+
5
+
6
+ ### Fixed
7
+
8
+ - Fix NoMethodError when trying to get AST of a Builder's result. (via #107) (@estum)
9
+
10
+ ### Changed
11
+
12
+ - Set 3.1 as minimum ruby version (@flash-gordon)
13
+
14
+ [Compare v1.5.0...v1.6.0](https://github.com/dry-rb/dry-logic/compare/v1.5.0...v1.6.0)
15
+
16
+ ## 1.5.0 2022-11-24
4
17
 
5
18
 
6
19
  ### Added
@@ -9,10 +22,19 @@
9
22
 
10
23
  ### Changed
11
24
 
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)
25
+ - Made `Predicates.respond_to?` compatible with `Object#respond_to?` (via #105) (@solnic)
26
+ - Made `Predicates.eql?` compatible with `Object#eql?` (via #106) (@solnic)
27
+
28
+ [Compare v1.4.0...v1.5.0](https://github.com/dry-rb/dry-logic/compare/v1.4.0...v1.5.0)
29
+
30
+ ## 1.4.0 2022-11-04
31
+
32
+
33
+ ### Changed
34
+
35
+ - Updated to dry-core 1.0 (@flash-gordon + @solnic)
14
36
 
15
- [Compare v1.3.0...master](https://github.com/dry-rb/dry-logic/compare/v1.3.0...master)
37
+ [Compare v1.3.0...v1.4.0](https://github.com/dry-rb/dry-logic/compare/v1.3.0...v1.4.0)
16
38
 
17
39
  ## 1.3.0 2022-10-15
18
40
 
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2022 dry-rb team
3
+ Copyright (c) 2015-2023 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,29 +1,21 @@
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
 
23
15
  This library officially supports the following Ruby versions:
24
16
 
25
- * MRI `>= 2.7.0`
26
- * jruby `>= 9.3` (postponed until 2.7 is supported)
17
+ * MRI `>= 3.1`
18
+ * jruby `>= 9.4` (not tested on CI)
27
19
 
28
20
  ## License
29
21
 
data/dry-logic.gemspec CHANGED
@@ -25,15 +25,13 @@ Gem::Specification.new do |spec|
25
25
  spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-logic/blob/main/CHANGELOG.md"
26
26
  spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-logic"
27
27
  spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-logic/issues"
28
+ spec.metadata["rubygems_mfa_required"] = "true"
28
29
 
29
- spec.required_ruby_version = ">= 2.7.0"
30
+ spec.required_ruby_version = ">= 3.1.0"
30
31
 
31
32
  # to update dependencies edit project.yml
32
- spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
33
- spec.add_runtime_dependency "dry-core", "~> 1.0", "< 2"
34
- spec.add_runtime_dependency "zeitwerk", "~> 2.6"
35
-
36
- spec.add_development_dependency "bundler"
37
- spec.add_development_dependency "rake"
38
- spec.add_development_dependency "rspec"
33
+ spec.add_dependency "bigdecimal"
34
+ spec.add_dependency "concurrent-ruby", "~> 1.0"
35
+ spec.add_dependency "dry-core", "~> 1.1"
36
+ spec.add_dependency "zeitwerk", "~> 2.6"
39
37
  end
@@ -28,8 +28,8 @@ module Dry
28
28
  # p is_zero.call(1) # => false
29
29
  # p is_zero.call(0) # => true
30
30
  # p is_zero.call(-1) # => false
31
- def call(&context)
32
- Context.instance.call(&context)
31
+ def call(&)
32
+ Context.instance.call(&)
33
33
  end
34
34
  module_function :call
35
35
  alias_method :build, :call
@@ -44,23 +44,23 @@ module Dry
44
44
  end
45
45
 
46
46
  # @see Builder#call
47
- def call(&context)
48
- instance_eval(&context)
47
+ def call(&)
48
+ instance_eval(&)
49
49
  end
50
50
 
51
51
  # Defines custom predicate
52
52
  #
53
53
  # @name [Symbol] Name of predicate
54
54
  # @Context [Proc]
55
- def predicate(name, &context)
55
+ def predicate(name, context = nil, &block)
56
56
  if singleton_class.method_defined?(name)
57
57
  singleton_class.undef_method(name)
58
58
  end
59
59
 
60
- prerdicate = Rule::Predicate.new(context)
60
+ predicate = Rule::Predicate.new(context || block)
61
61
 
62
62
  define_singleton_method(name) do |*args|
63
- prerdicate.curry(*args)
63
+ predicate.curry(*args)
64
64
  end
65
65
  end
66
66
 
@@ -78,7 +78,7 @@ module Dry
78
78
 
79
79
  Predicates::Methods.instance_methods(false).each do |name|
80
80
  unless IGNORED_PREDICATES.include?(name)
81
- predicate(name, &Predicates[name])
81
+ predicate(name, Predicates[name])
82
82
  end
83
83
  end
84
84
  end
@@ -5,7 +5,7 @@ module Dry
5
5
  module Operations
6
6
  class Abstract
7
7
  include Core::Constants
8
- include Dry::Equalizer(:rules, :options)
8
+ include ::Dry::Equalizer(:rules, :options)
9
9
  include Operators
10
10
 
11
11
  attr_reader :rules
@@ -8,7 +8,7 @@ module Dry
8
8
 
9
9
  def self.new(rule, **options)
10
10
  if options[:evaluator]
11
- super(rule, **options)
11
+ super
12
12
  else
13
13
  keys = options.fetch(:keys)
14
14
  evaluator = Evaluator::Set.new(keys)
@@ -23,7 +23,7 @@ module Dry
23
23
  end
24
24
 
25
25
  def [](arr)
26
- arr.map { |input| rule[input] }.all?
26
+ arr.all? { |input| rule[input] }
27
27
  end
28
28
  end
29
29
  end
@@ -1,12 +1,17 @@
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"
8
+ require "uri"
6
9
 
7
10
  module Dry
8
11
  module Logic
9
12
  module Predicates
13
+ include ::Dry::Core::Constants
14
+
10
15
  # rubocop:disable Metrics/ModuleLength
11
16
  module Methods
12
17
  def self.uuid_format(version)
@@ -25,161 +30,113 @@ module Dry
25
30
 
26
31
  UUIDv5 = uuid_format(5)
27
32
 
33
+ UUIDv6 = uuid_format(6)
34
+
35
+ UUIDv7 = uuid_format(7)
36
+
37
+ UUIDv8 = uuid_format(8)
38
+
28
39
  def [](name)
29
40
  method(name)
30
41
  end
31
42
 
32
- def type?(type, input)
33
- input.is_a?(type)
34
- end
43
+ def type?(type, input) = input.is_a?(type)
35
44
 
36
- def nil?(input)
37
- input.nil?
38
- end
45
+ def nil?(input) = input.nil?
39
46
  alias_method :none?, :nil?
40
47
 
41
- def key?(name, input)
42
- input.key?(name)
43
- end
48
+ def key?(name, input) = input.key?(name)
44
49
 
45
- def attr?(name, input)
46
- input.respond_to?(name)
47
- end
50
+ def attr?(name, input) = input.respond_to?(name)
48
51
 
49
52
  def empty?(input)
50
53
  case input
51
- when String, Array, Hash then input.empty?
54
+ when ::String, ::Array, ::Hash then input.empty?
52
55
  when nil then true
53
56
  else
54
57
  false
55
58
  end
56
59
  end
57
60
 
58
- def filled?(input)
59
- !empty?(input)
60
- end
61
+ def filled?(input) = !empty?(input)
61
62
 
62
- def bool?(input)
63
- input.is_a?(TrueClass) || input.is_a?(FalseClass)
64
- end
63
+ def bool?(input) = input.equal?(true) || input.equal?(false)
65
64
 
66
- def date?(input)
67
- input.is_a?(Date)
68
- end
65
+ def date?(input) = input.is_a?(::Date)
69
66
 
70
- def date_time?(input)
71
- input.is_a?(DateTime)
72
- end
67
+ def date_time?(input) = input.is_a?(::DateTime)
73
68
 
74
- def time?(input)
75
- input.is_a?(Time)
76
- end
69
+ def time?(input) = input.is_a?(::Time)
77
70
 
78
71
  def number?(input)
79
72
  true if Float(input)
80
- rescue ArgumentError, TypeError
73
+ rescue ::ArgumentError, ::TypeError
81
74
  false
82
75
  end
83
76
 
84
- def int?(input)
85
- input.is_a?(Integer)
86
- end
77
+ def int?(input) = input.is_a?(::Integer)
87
78
 
88
- def float?(input)
89
- input.is_a?(Float)
90
- end
79
+ def float?(input) = input.is_a?(::Float)
91
80
 
92
- def decimal?(input)
93
- input.is_a?(BigDecimal)
94
- end
81
+ def decimal?(input) = input.is_a?(::BigDecimal)
95
82
 
96
- def str?(input)
97
- input.is_a?(String)
98
- end
83
+ def str?(input) = input.is_a?(::String)
99
84
 
100
- def hash?(input)
101
- input.is_a?(Hash)
102
- end
85
+ def hash?(input) = input.is_a?(::Hash)
103
86
 
104
- def array?(input)
105
- input.is_a?(Array)
106
- end
87
+ def array?(input) = input.is_a?(::Array)
107
88
 
108
- def odd?(input)
109
- input.odd?
110
- end
89
+ def odd?(input) = input.odd?
111
90
 
112
- def even?(input)
113
- input.even?
114
- end
91
+ def even?(input) = input.even?
115
92
 
116
- def lt?(num, input)
117
- input < num
118
- end
93
+ def lt?(num, input) = input < num
119
94
 
120
- def gt?(num, input)
121
- input > num
122
- end
95
+ def gt?(num, input) = input > num
123
96
 
124
- def lteq?(num, input)
125
- !gt?(num, input)
126
- end
97
+ def lteq?(num, input) = !gt?(num, input)
127
98
 
128
- def gteq?(num, input)
129
- !lt?(num, input)
130
- end
99
+ def gteq?(num, input) = !lt?(num, input)
131
100
 
132
101
  def size?(size, input)
133
102
  case size
134
- when Integer then size.equal?(input.size)
135
- when Range, Array then size.include?(input.size)
103
+ when ::Integer then size.equal?(input.size)
104
+ when ::Range, ::Array then size.include?(input.size)
136
105
  else
137
- raise ArgumentError, "+#{size}+ is not supported type for size? predicate."
106
+ raise ::ArgumentError, "+#{size}+ is not supported type for size? predicate."
138
107
  end
139
108
  end
140
109
 
141
- def min_size?(num, input)
142
- input.size >= num
143
- end
110
+ def min_size?(num, input) = input.size >= num
144
111
 
145
- def max_size?(num, input)
146
- input.size <= num
147
- end
112
+ def max_size?(num, input) = input.size <= num
148
113
 
149
114
  def bytesize?(size, input)
150
115
  case size
151
- when Integer then size.equal?(input.bytesize)
152
- when Range, Array then size.include?(input.bytesize)
116
+ when ::Integer then size.equal?(input.bytesize)
117
+ when ::Range, ::Array then size.include?(input.bytesize)
153
118
  else
154
- raise ArgumentError, "+#{size}+ is not supported type for bytesize? predicate."
119
+ raise ::ArgumentError, "+#{size}+ is not supported type for bytesize? predicate."
155
120
  end
156
121
  end
157
122
 
158
- def min_bytesize?(num, input)
159
- input.bytesize >= num
160
- end
123
+ def min_bytesize?(num, input) = input.bytesize >= num
161
124
 
162
- def max_bytesize?(num, input)
163
- input.bytesize <= num
164
- end
125
+ def max_bytesize?(num, input) = input.bytesize <= num
165
126
 
166
127
  def inclusion?(list, input)
167
- ::Kernel.warn "inclusion is deprecated - use included_in instead."
128
+ deprecated(:inclusion?, :included_in?)
168
129
  included_in?(list, input)
169
130
  end
170
131
 
171
132
  def exclusion?(list, input)
172
- ::Kernel.warn "exclusion is deprecated - use excluded_from instead."
133
+ deprecated(:exclusion?, :excluded_from?)
173
134
  excluded_from?(list, input)
174
135
  end
175
136
 
176
- def included_in?(list, input)
177
- list.include?(input)
178
- end
137
+ def included_in?(list, input) = list.include?(input)
179
138
 
180
- def excluded_from?(list, input)
181
- !list.include?(input)
182
- end
139
+ def excluded_from?(list, input) = !list.include?(input)
183
140
 
184
141
  def includes?(value, input)
185
142
  if input.respond_to?(:include?)
@@ -187,79 +144,80 @@ module Dry
187
144
  else
188
145
  false
189
146
  end
190
- rescue TypeError
147
+ rescue ::TypeError
191
148
  false
192
149
  end
193
150
 
194
- def excludes?(value, input)
195
- !includes?(value, input)
196
- end
151
+ def excludes?(value, input) = !includes?(value, input)
152
+
153
+ # This overrides Object#eql? so we need to make it compatible
154
+ def eql?(left, right = Undefined)
155
+ return super(left) if right.equal?(Undefined)
197
156
 
198
- def eql?(left, right)
199
157
  left.eql?(right)
200
158
  end
201
159
 
202
- def is?(left, right)
203
- left.equal?(right)
204
- end
160
+ def is?(left, right) = left.equal?(right)
205
161
 
206
- def not_eql?(left, right)
207
- !left.eql?(right)
208
- end
162
+ def not_eql?(left, right) = !left.eql?(right)
209
163
 
210
- def true?(value)
211
- value.equal?(true)
212
- end
164
+ def true?(value) = value.equal?(true)
213
165
 
214
- def false?(value)
215
- value.equal?(false)
216
- end
166
+ def false?(value) = value.equal?(false)
217
167
 
218
- def format?(regex, input)
219
- !input.nil? && regex.match?(input)
220
- end
168
+ def format?(regex, input) = !input.nil? && regex.match?(input)
221
169
 
222
- def case?(pattern, input)
223
- # rubocop:disable Style/CaseEquality
224
- pattern === input
225
- # rubocop:enable Style/CaseEquality
226
- end
170
+ def case?(pattern, input) = pattern === input # rubocop:disable Style/CaseEquality
227
171
 
228
- def uuid_v1?(input)
229
- format?(UUIDv1, input)
230
- end
172
+ def uuid_v1?(input) = format?(UUIDv1, input)
231
173
 
232
- def uuid_v2?(input)
233
- format?(UUIDv2, input)
234
- end
174
+ def uuid_v2?(input) = format?(UUIDv2, input)
235
175
 
236
- def uuid_v3?(input)
237
- format?(UUIDv3, input)
238
- end
176
+ def uuid_v3?(input) = format?(UUIDv3, input)
239
177
 
240
- def uuid_v4?(input)
241
- format?(UUIDv4, input)
242
- end
178
+ def uuid_v4?(input) = format?(UUIDv4, input)
243
179
 
244
- def uuid_v5?(input)
245
- format?(UUIDv5, input)
246
- end
180
+ def uuid_v5?(input) = format?(UUIDv5, input)
247
181
 
248
- def uri?(schemes, input)
249
- uri_format = URI::DEFAULT_PARSER.make_regexp(schemes)
250
- format?(uri_format, input)
251
- end
182
+ def uuid_v6?(input) = format?(UUIDv6, input)
183
+
184
+ def uuid_v7?(input) = format?(UUIDv7, input)
185
+
186
+ def uuid_v8?(input) = format?(UUIDv8, input)
252
187
 
253
- def uri_rfc3986?(input)
254
- format?(URI::RFC3986_Parser::RFC3986_URI, input)
188
+ if defined?(::URI::RFC2396_PARSER)
189
+ def uri?(schemes, input)
190
+ uri_format = ::URI::RFC2396_PARSER.make_regexp(schemes)
191
+ format?(uri_format, input)
192
+ end
193
+ else
194
+ def uri?(schemes, input)
195
+ uri_format = ::URI::DEFAULT_PARSER.make_regexp(schemes)
196
+ format?(uri_format, input)
197
+ end
255
198
  end
256
199
 
257
- def respond_to?(method, input)
200
+ def uri_rfc3986?(input) = format?(::URI::RFC3986_Parser::RFC3986_URI, input)
201
+
202
+ # This overrides Object#respond_to? so we need to make it compatible
203
+ def respond_to?(method, input = Undefined)
204
+ return super if input.equal?(Undefined)
205
+
258
206
  input.respond_to?(method)
259
207
  end
260
208
 
261
- def predicate(name, &block)
262
- define_singleton_method(name, &block)
209
+ def predicate(name, &)
210
+ define_singleton_method(name, &)
211
+ end
212
+
213
+ def deprecated(name, in_favor_of)
214
+ Core::Deprecations.warn(
215
+ "#{name} predicate is deprecated and will " \
216
+ "be removed in the next major version\n" \
217
+ "Please use #{in_favor_of} predicate instead",
218
+ tag: "dry-logic",
219
+ uplevel: 3
220
+ )
263
221
  end
264
222
  end
265
223
 
@@ -3,7 +3,7 @@
3
3
  module Dry
4
4
  module Logic
5
5
  class Result
6
- SUCCESS = Class.new {
6
+ SUCCESS = ::Class.new {
7
7
  def success?
8
8
  true
9
9
  end
@@ -29,17 +29,11 @@ module Dry
29
29
  end
30
30
  end
31
31
 
32
- def constant?
33
- arity.zero?
34
- end
32
+ def constant? = arity.zero?
35
33
 
36
- def variable_arity?
37
- arity.negative?
38
- end
34
+ def variable_arity? = arity.negative?
39
35
 
40
- def curried?
41
- !curried.zero?
42
- end
36
+ def curried? = !curried.zero?
43
37
 
44
38
  def unapplied
45
39
  if variable_arity?
@@ -116,26 +110,26 @@ module Dry
116
110
  application = "@predicate[#{(curried_args + unapplied_args + splat).join(", ")}]"
117
111
 
118
112
  module_eval(<<~RUBY, __FILE__, __LINE__ + 1)
119
- def call(#{parameters}) # def call(input0, input1, *rest)
120
- if #{application} # if @predicate[@arg0, @arg1, input0, input1, *rest]
121
- Result::SUCCESS # ::Dry::Logic::Result::Success
122
- else # else
123
- Result.new(false, id) { ast(#{parameters}) } # ::Dry::Logic::Result.new(false, id) { ast(input0, input1, *rest) }
124
- end # end
125
- end # end
126
- #
127
- def [](#{parameters}) # def [](@arg0, @arg1, input0, input1, *rest)
128
- #{application} # @predicate[@arg0, @arg1, input0, input1, *rest]
129
- end # end
113
+ def call(#{parameters}) # def call(input0, input1, *rest)
114
+ if #{application} # if @predicate[@arg0, @arg1, input0, input1, *rest]
115
+ Result::SUCCESS # ::Dry::Logic::Result::Success
116
+ else # else
117
+ Result.new(false, id) { ast(#{parameters}) } # ::Dry::Logic::Result.new(false, id) { ast(input0, input1, *rest) }
118
+ end # end
119
+ end # end
120
+ #
121
+ def [](#{parameters}) # def [](@arg0, @arg1, input0, input1, *rest)
122
+ #{application} # @predicate[@arg0, @arg1, input0, input1, *rest]
123
+ end # end
130
124
  RUBY
131
125
  end
132
126
 
133
127
  def curried_args
134
- @curried_args ||= ::Array.new(curried) { |i| "@arg#{i}" }
128
+ @curried_args ||= ::Array.new(curried) { "@arg#{_1}" }
135
129
  end
136
130
 
137
131
  def unapplied_args
138
- @unapplied_args ||= ::Array.new(unapplied) { |i| "input#{i}" }
132
+ @unapplied_args ||= ::Array.new(unapplied) { "input#{_1}" }
139
133
  end
140
134
  end
141
135
  end
@@ -14,7 +14,7 @@ module Dry
14
14
 
15
15
  class Rule
16
16
  include Core::Constants
17
- include Dry::Equalizer(:predicate, :options)
17
+ include ::Dry::Equalizer(:predicate, :options)
18
18
  include Operators
19
19
 
20
20
  attr_reader :predicate
@@ -32,7 +32,7 @@ module Dry
32
32
  def self.specialize(arity, curried, base = Rule)
33
33
  base.interfaces.fetch_or_store([arity, curried]) do
34
34
  interface = Interface.new(arity, curried)
35
- klass = Class.new(base) { include interface }
35
+ klass = ::Class.new(base) { include interface }
36
36
  base.const_set("#{base.name.split("::").last}#{interface.name}", klass)
37
37
  klass
38
38
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Logic
5
- VERSION = "1.4.0"
5
+ VERSION = "1.6.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,39 +1,36 @@
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.6.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-04 00:00:00.000000000 Z
11
+ date: 2025-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: concurrent-ruby
14
+ name: bigdecimal
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: dry-core
28
+ name: concurrent-ruby
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.0'
34
- - - "<"
35
- - !ruby/object:Gem::Version
36
- version: '2'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
@@ -41,65 +38,34 @@ dependencies:
41
38
  - - "~>"
42
39
  - !ruby/object:Gem::Version
43
40
  version: '1.0'
44
- - - "<"
45
- - !ruby/object:Gem::Version
46
- version: '2'
47
41
  - !ruby/object:Gem::Dependency
48
- name: zeitwerk
42
+ name: dry-core
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
45
  - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: '2.6'
47
+ version: '1.1'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
51
  requirements:
58
52
  - - "~>"
59
53
  - !ruby/object:Gem::Version
60
- version: '2.6'
54
+ version: '1.1'
61
55
  - !ruby/object:Gem::Dependency
62
- name: bundler
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: '0'
68
- type: :development
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: '0'
75
- - !ruby/object:Gem::Dependency
76
- name: rake
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- version: '0'
82
- type: :development
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- version: '0'
89
- - !ruby/object:Gem::Dependency
90
- name: rspec
56
+ name: zeitwerk
91
57
  requirement: !ruby/object:Gem::Requirement
92
58
  requirements:
93
- - - ">="
59
+ - - "~>"
94
60
  - !ruby/object:Gem::Version
95
- version: '0'
96
- type: :development
61
+ version: '2.6'
62
+ type: :runtime
97
63
  prerelease: false
98
64
  version_requirements: !ruby/object:Gem::Requirement
99
65
  requirements:
100
- - - ">="
66
+ - - "~>"
101
67
  - !ruby/object:Gem::Version
102
- version: '0'
68
+ version: '2.6'
103
69
  description: Predicate logic with rule composition
104
70
  email:
105
71
  - piotr.solnica@gmail.com
@@ -145,7 +111,8 @@ metadata:
145
111
  changelog_uri: https://github.com/dry-rb/dry-logic/blob/main/CHANGELOG.md
146
112
  source_code_uri: https://github.com/dry-rb/dry-logic
147
113
  bug_tracker_uri: https://github.com/dry-rb/dry-logic/issues
148
- post_install_message:
114
+ rubygems_mfa_required: 'true'
115
+ post_install_message:
149
116
  rdoc_options: []
150
117
  require_paths:
151
118
  - lib
@@ -153,15 +120,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
153
120
  requirements:
154
121
  - - ">="
155
122
  - !ruby/object:Gem::Version
156
- version: 2.7.0
123
+ version: 3.1.0
157
124
  required_rubygems_version: !ruby/object:Gem::Requirement
158
125
  requirements:
159
126
  - - ">="
160
127
  - !ruby/object:Gem::Version
161
128
  version: '0'
162
129
  requirements: []
163
- rubygems_version: 3.1.6
164
- signing_key:
130
+ rubygems_version: 3.3.27
131
+ signing_key:
165
132
  specification_version: 4
166
133
  summary: Predicate logic with rule composition
167
134
  test_files: []