dry-logic 1.2.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: 1e3f807ddbab8319c1c039978115800a4f8c6d41b337815cdaf6226563716a3d
4
- data.tar.gz: 79cb10c28f23ebc523c15f4cd3da9657aeeb9923f7ed778bfaaa10c5dd59824c
3
+ metadata.gz: 58ce7aca14ea687be3852f8f6359ea33de4da0f057091127f828dbb2e6db8856
4
+ data.tar.gz: 283cf7ff61520f4ca1822bea434bd9b98ccb07c10e17f628e0f440029ca76092
5
5
  SHA512:
6
- metadata.gz: ad9c5d83eb742610eddb8ea47be7a31cffcfee956223d08a1f595c90b02289d16b78e0dfe4b7ff48cf3fec7b79a586aab148a8e00afc67a9b8e0a6600f8687cc
7
- data.tar.gz: 1df8067e98f4b90ff921a1d0eccaef3e29aa1b819337110cb2b20deb2e60215433118d2ba30bd54f41e5dec634b76a65d52c18fd924992c62ba4735a5fbd97a1
6
+ metadata.gz: 8d16672e062a05eb7c79a5ce34f47307b8eb7cba7cefce4c39d513f835b59fd711968e5bccb8a5f6e7c125aeec6485a4ff9193cc046390c44e2f4f4090f3ad44
7
+ data.tar.gz: 4fbe122584b52eda9d699726023c09fcc9e636f8f67d3670de584b0a7d6345ebdac17ea7173bfa753aab35500eeb8f95d9941b851c980cd6fcac5c3cac8d879d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
2
 
3
+ ## 1.5.0 2022-11-24
4
+
5
+
6
+ ### Added
7
+
8
+ - `uri_rfc3986?` predicate that uses a better regexp than `uri?` (see #94 for more details) (@hieuk09)
9
+
10
+ ### Changed
11
+
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
+
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)
25
+
26
+ ## 1.3.0 2022-10-15
27
+
28
+
29
+ ### Changed
30
+
31
+ - Use zeitwerk for auto-loading (@solnic + @flash-gordon)
32
+
33
+ [Compare v1.2.0...v1.3.0](https://github.com/dry-rb/dry-logic/compare/v1.2.0...v1.3.0)
34
+
3
35
  ## 1.2.0 2021-04-26
4
36
 
5
37
 
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2021 dry-rb team
3
+ Copyright (c) 2015-2022 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,28 +1,21 @@
1
+ <!--- this file is synced from dry-rb/template-gem project -->
1
2
  [gem]: https://rubygems.org/gems/dry-logic
2
3
  [actions]: https://github.com/dry-rb/dry-logic/actions
3
- [codacy]: https://www.codacy.com/gh/dry-rb/dry-logic
4
- [chat]: https://dry-rb.zulipchat.com
5
- [inchpages]: http://inch-ci.org/github/dry-rb/dry-logic
6
4
 
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
-
9
- [![Gem Version](https://badge.fury.io/rb/dry-logic.svg)][gem]
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
- [![Inline docs](http://inch-ci.org/github/dry-rb/dry-logic.svg?branch=master)][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]
14
6
 
15
7
  ## Links
16
8
 
17
- * [User documentation](http://dry-rb.org/gems/dry-logic)
9
+ * [User documentation](https://dry-rb.org/gems/dry-logic)
18
10
  * [API documentation](http://rubydoc.info/gems/dry-logic)
11
+ * [Forum](https://discourse.dry-rb.org)
19
12
 
20
13
  ## Supported Ruby versions
21
14
 
22
15
  This library officially supports the following Ruby versions:
23
16
 
24
- * MRI >= `2.5`
25
- * jruby >= `9.2`
17
+ * MRI `>= 2.7.0`
18
+ * jruby `>= 9.3` (postponed until 2.7 is supported)
26
19
 
27
20
  ## License
28
21
 
data/dry-logic.gemspec CHANGED
@@ -1,35 +1,37 @@
1
1
  # frozen_string_literal: true
2
- # this file is managed by dry-rb/devtools project
3
2
 
4
- lib = File.expand_path('lib', __dir__)
3
+ # this file is synced from dry-rb/template-gem project
4
+
5
+ lib = File.expand_path("lib", __dir__)
5
6
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
- require 'dry/logic/version'
7
+ require "dry/logic/version"
7
8
 
8
9
  Gem::Specification.new do |spec|
9
- spec.name = 'dry-logic'
10
+ spec.name = "dry-logic"
10
11
  spec.authors = ["Piotr Solnica"]
11
12
  spec.email = ["piotr.solnica@gmail.com"]
12
- spec.license = 'MIT'
13
+ spec.license = "MIT"
13
14
  spec.version = Dry::Logic::VERSION.dup
14
15
 
15
16
  spec.summary = "Predicate logic with rule composition"
16
17
  spec.description = spec.summary
17
- spec.homepage = 'https://dry-rb.org/gems/dry-logic'
18
+ spec.homepage = "https://dry-rb.org/gems/dry-logic"
18
19
  spec.files = Dir["CHANGELOG.md", "LICENSE", "README.md", "dry-logic.gemspec", "lib/**/*"]
19
- spec.bindir = 'bin'
20
+ spec.bindir = "bin"
20
21
  spec.executables = []
21
- spec.require_paths = ['lib']
22
+ spec.require_paths = ["lib"]
22
23
 
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'
24
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
25
+ spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-logic/blob/main/CHANGELOG.md"
26
+ spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-logic"
27
+ spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-logic/issues"
27
28
 
28
- spec.required_ruby_version = ">= 2.5.0"
29
+ spec.required_ruby_version = ">= 2.7.0"
29
30
 
30
31
  # to update dependencies edit project.yml
31
32
  spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
32
- spec.add_runtime_dependency "dry-core", "~> 0.5", ">= 0.5"
33
+ spec.add_runtime_dependency "dry-core", "~> 1.0", "< 2"
34
+ spec.add_runtime_dependency "zeitwerk", "~> 2.6"
33
35
 
34
36
  spec.add_development_dependency "bundler"
35
37
  spec.add_development_dependency "rake"
@@ -1,13 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/logic"
4
3
  require "singleton"
5
4
  require "delegate"
6
5
 
7
6
  module Dry
8
7
  module Logic
9
- autoload :Operations, "dry/logic/operations"
10
- autoload :Predicates, "dry/logic/predicates"
11
8
  module Builder
12
9
  IGNORED_OPERATIONS = %i[
13
10
  Abstract
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/core/equalizer"
4
-
5
3
  module Dry
6
4
  module Logic
7
5
  class Evaluator
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/core/constants"
4
- require "dry/core/equalizer"
5
- require "dry/logic/operators"
6
-
7
3
  module Dry
8
4
  module Logic
9
5
  module Operations
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/logic/operations/binary"
4
- require "dry/logic/result"
5
-
6
3
  module Dry
7
4
  module Logic
8
5
  module Operations
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/logic/operations/key"
4
-
5
3
  module Dry
6
4
  module Logic
7
5
  module Operations
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/logic/operations/abstract"
4
-
5
3
  module Dry
6
4
  module Logic
7
5
  module Operations
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/logic/operations/unary"
4
- require "dry/logic/evaluator"
5
- require "dry/logic/result"
6
-
7
3
  module Dry
8
4
  module Logic
9
5
  module Operations
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/logic/operations/unary"
4
- require "dry/logic/result"
5
-
6
3
  module Dry
7
4
  module Logic
8
5
  module Operations
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/logic/operations/binary"
4
- require "dry/logic/result"
5
-
6
3
  module Dry
7
4
  module Logic
8
5
  module Operations
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/logic/operations/unary"
4
- require "dry/logic/evaluator"
5
- require "dry/logic/result"
6
-
7
3
  module Dry
8
4
  module Logic
9
5
  module Operations
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/logic/operations/unary"
4
- require "dry/logic/result"
5
-
6
3
  module Dry
7
4
  module Logic
8
5
  module Operations
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/logic/operations/binary"
4
- require "dry/logic/result"
5
-
6
3
  module Dry
7
4
  module Logic
8
5
  module Operations
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/logic/operations/abstract"
4
- require "dry/logic/result"
5
-
6
3
  module Dry
7
4
  module Logic
8
5
  module Operations
@@ -16,7 +13,7 @@ module Dry
16
13
  success = results.all?(&:success?)
17
14
 
18
15
  Result.new(success, id) do
19
- [type, results.select(&:failure?).map { |failure| failure.to_ast }]
16
+ [type, results.select(&:failure?).map(&:to_ast)]
20
17
  end
21
18
  end
22
19
 
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/logic/operations/abstract"
4
-
5
3
  module Dry
6
4
  module Logic
7
5
  module Operations
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/logic/operations/binary"
4
- require "dry/logic/result"
5
-
6
3
  module Dry
7
4
  module Logic
8
5
  module Operations
@@ -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,7 +9,26 @@ require "date"
7
9
  module Dry
8
10
  module Logic
9
11
  module Predicates
12
+ include Dry::Core::Constants
13
+
14
+ # rubocop:disable Metrics/ModuleLength
10
15
  module Methods
16
+ def self.uuid_format(version)
17
+ ::Regexp.new(<<~FORMAT.chomp, ::Regexp::IGNORECASE)
18
+ \\A[0-9A-F]{8}-[0-9A-F]{4}-#{version}[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}\\z
19
+ FORMAT
20
+ end
21
+
22
+ UUIDv1 = uuid_format(1)
23
+
24
+ UUIDv2 = uuid_format(2)
25
+
26
+ UUIDv3 = uuid_format(3)
27
+
28
+ UUIDv4 = uuid_format(4)
29
+
30
+ UUIDv5 = uuid_format(5)
31
+
11
32
  def [](name)
12
33
  method(name)
13
34
  end
@@ -147,12 +168,12 @@ module Dry
147
168
  end
148
169
 
149
170
  def inclusion?(list, input)
150
- ::Kernel.warn "inclusion is deprecated - use included_in instead."
171
+ deprecated(:inclusion?, :included_in?)
151
172
  included_in?(list, input)
152
173
  end
153
174
 
154
175
  def exclusion?(list, input)
155
- ::Kernel.warn "exclusion is deprecated - use excluded_from instead."
176
+ deprecated(:exclusion?, :excluded_from?)
156
177
  excluded_from?(list, input)
157
178
  end
158
179
 
@@ -178,7 +199,10 @@ module Dry
178
199
  !includes?(value, input)
179
200
  end
180
201
 
181
- 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
+
182
206
  left.eql?(right)
183
207
  end
184
208
 
@@ -203,32 +227,29 @@ module Dry
203
227
  end
204
228
 
205
229
  def case?(pattern, input)
230
+ # rubocop:disable Style/CaseEquality
206
231
  pattern === input
232
+ # rubocop:enable Style/CaseEquality
207
233
  end
208
234
 
209
235
  def uuid_v1?(input)
210
- uuid_v1_format = /\A[0-9A-F]{8}-[0-9A-F]{4}-1[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}\z/i
211
- format?(uuid_v1_format, input)
236
+ format?(UUIDv1, input)
212
237
  end
213
238
 
214
239
  def uuid_v2?(input)
215
- uuid_v2_format = /\A[0-9A-F]{8}-[0-9A-F]{4}-2[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}\z/i
216
- format?(uuid_v2_format, input)
240
+ format?(UUIDv2, input)
217
241
  end
218
242
 
219
243
  def uuid_v3?(input)
220
- uuid_v3_format = /\A[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}\z/i
221
- format?(uuid_v3_format, input)
244
+ format?(UUIDv3, input)
222
245
  end
223
246
 
224
247
  def uuid_v4?(input)
225
- uuid_v4_format = /\A[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}\z/i
226
- format?(uuid_v4_format, input)
248
+ format?(UUIDv4, input)
227
249
  end
228
250
 
229
251
  def uuid_v5?(input)
230
- uuid_v5_format = /\A[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}\z/i
231
- format?(uuid_v5_format, input)
252
+ format?(UUIDv5, input)
232
253
  end
233
254
 
234
255
  def uri?(schemes, input)
@@ -236,13 +257,30 @@ module Dry
236
257
  format?(uri_format, input)
237
258
  end
238
259
 
239
- def respond_to?(method, input)
260
+ def uri_rfc3986?(input)
261
+ format?(URI::RFC3986_Parser::RFC3986_URI, input)
262
+ end
263
+
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
+
240
268
  input.respond_to?(method)
241
269
  end
242
270
 
243
271
  def predicate(name, &block)
244
272
  define_singleton_method(name, &block)
245
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
246
284
  end
247
285
 
248
286
  extend Methods
@@ -252,5 +290,6 @@ module Dry
252
290
  other.extend(Methods)
253
291
  end
254
292
  end
293
+ # rubocop:enable Metrics/ModuleLength
255
294
  end
256
295
  end
@@ -1,12 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/core/constants"
4
-
5
3
  module Dry
6
4
  module Logic
7
5
  class Result
8
- include Core::Constants
9
-
10
6
  SUCCESS = Class.new {
11
7
  def success?
12
8
  true
@@ -11,6 +11,8 @@ module Dry
11
11
  attr_reader :curried
12
12
 
13
13
  def initialize(arity, curried)
14
+ super()
15
+
14
16
  @arity = arity
15
17
  @curried = curried
16
18
 
@@ -84,11 +86,11 @@ module Dry
84
86
  end
85
87
 
86
88
  module_eval(<<~RUBY, __FILE__, __LINE__ + 1)
87
- def initialize(*)
88
- super
89
-
90
- #{assignment}
91
- end
89
+ def initialize(*) # def initialize(*)
90
+ super # super
91
+ #
92
+ #{assignment} # @arg0 = @args[0]
93
+ end # end
92
94
  RUBY
93
95
  end
94
96
 
@@ -114,17 +116,17 @@ module Dry
114
116
  application = "@predicate[#{(curried_args + unapplied_args + splat).join(", ")}]"
115
117
 
116
118
  module_eval(<<~RUBY, __FILE__, __LINE__ + 1)
117
- def call(#{parameters})
118
- if #{application}
119
- Result::SUCCESS
120
- else
121
- Result.new(false, id) { ast(#{parameters}) }
122
- end
123
- end
124
-
125
- def [](#{parameters})
126
- #{application}
127
- end
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
128
130
  RUBY
129
131
  end
130
132
 
@@ -1,34 +1,34 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/logic/rule"
4
-
5
3
  module Dry
6
4
  module Logic
7
- class Rule::Predicate < Rule
8
- def self.specialize(arity, curried, base = Predicate)
9
- super
10
- end
5
+ class Rule
6
+ class Predicate < Rule
7
+ def self.specialize(arity, curried, base = Predicate)
8
+ super
9
+ end
11
10
 
12
- def type
13
- :predicate
14
- end
11
+ def type
12
+ :predicate
13
+ end
15
14
 
16
- def name
17
- predicate.name
18
- end
15
+ def name
16
+ predicate.name
17
+ end
19
18
 
20
- def to_s
21
- if args.size > 0
22
- "#{name}(#{args.map(&:inspect).join(", ")})"
23
- else
24
- name.to_s
19
+ def to_s
20
+ if args.empty?
21
+ name.to_s
22
+ else
23
+ "#{name}(#{args.map(&:inspect).join(", ")})"
24
+ end
25
25
  end
26
- end
27
26
 
28
- def ast(input = Undefined)
29
- [type, [name, args_with_names(input)]]
27
+ def ast(input = Undefined)
28
+ [type, [name, args_with_names(input)]]
29
+ end
30
+ alias_method :to_ast, :ast
30
31
  end
31
- alias_method :to_ast, :ast
32
32
  end
33
33
  end
34
34
  end
@@ -1,11 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "concurrent/map"
4
- require "dry/core/constants"
5
- require "dry/core/equalizer"
6
- require "dry/logic/operations"
7
- require "dry/logic/result"
8
- require "dry/logic/rule/interface"
9
4
 
10
5
  module Dry
11
6
  module Logic
@@ -78,7 +73,7 @@ module Dry
78
73
  end
79
74
 
80
75
  def eval_args(object)
81
- with(args: args.map { |arg| UnboundMethod === arg ? arg.bind(object).() : arg })
76
+ with(args: args.map { |arg| arg.is_a?(UnboundMethod) ? arg.bind(object).() : arg })
82
77
  end
83
78
 
84
79
  def with(new_opts)
@@ -1,15 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/core/constants"
4
-
5
- require "dry/logic/rule"
6
- require "dry/logic/rule/predicate"
7
-
8
3
  module Dry
9
4
  module Logic
10
5
  class RuleCompiler
11
- include Core::Constants
12
-
13
6
  attr_reader :predicates
14
7
 
15
8
  def initialize(predicates)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Logic
5
- VERSION = "1.2.0"
5
+ VERSION = "1.5.0"
6
6
  end
7
7
  end
data/lib/dry/logic.rb CHANGED
@@ -1,11 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # A collection of micro-libraries, each intended to encapsulate
4
- # a common task in Ruby
3
+ require "zeitwerk"
4
+ require "dry/core"
5
+
5
6
  module Dry
6
7
  module Logic
8
+ include Dry::Core::Constants
9
+
10
+ def self.loader
11
+ @loader ||= Zeitwerk::Loader.new.tap do |loader|
12
+ root = File.expand_path("..", __dir__)
13
+ loader.tag = "dry-logic"
14
+ loader.inflector = Zeitwerk::GemInflector.new("#{root}/dry-logic.rb")
15
+ loader.push_dir(root)
16
+ loader.ignore(
17
+ "#{root}/dry-logic.rb",
18
+ "#{root}/dry/logic/version.rb"
19
+ )
20
+ end
21
+ end
22
+
23
+ loader.setup
7
24
  end
8
25
  end
9
-
10
- require "dry/logic/rule/predicate"
11
- require "dry/logic/operations"
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.2.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: 2021-04-26 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,34 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.5'
34
- - - ">="
33
+ version: '1.0'
34
+ - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: '0.5'
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.5'
44
- - - ">="
43
+ version: '1.0'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '2'
47
+ - !ruby/object:Gem::Dependency
48
+ name: zeitwerk
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '2.6'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
45
59
  - !ruby/object:Gem::Version
46
- version: '0.5'
60
+ version: '2.6'
47
61
  - !ruby/object:Gem::Dependency
48
62
  name: bundler
49
63
  requirement: !ruby/object:Gem::Requirement
@@ -102,7 +116,6 @@ files:
102
116
  - lib/dry/logic/appliable.rb
103
117
  - lib/dry/logic/builder.rb
104
118
  - lib/dry/logic/evaluator.rb
105
- - lib/dry/logic/operations.rb
106
119
  - lib/dry/logic/operations/abstract.rb
107
120
  - lib/dry/logic/operations/and.rb
108
121
  - lib/dry/logic/operations/attr.rb
@@ -129,7 +142,7 @@ licenses:
129
142
  - MIT
130
143
  metadata:
131
144
  allowed_push_host: https://rubygems.org
132
- changelog_uri: https://github.com/dry-rb/dry-logic/blob/master/CHANGELOG.md
145
+ changelog_uri: https://github.com/dry-rb/dry-logic/blob/main/CHANGELOG.md
133
146
  source_code_uri: https://github.com/dry-rb/dry-logic
134
147
  bug_tracker_uri: https://github.com/dry-rb/dry-logic/issues
135
148
  post_install_message:
@@ -140,7 +153,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
153
  requirements:
141
154
  - - ">="
142
155
  - !ruby/object:Gem::Version
143
- version: 2.5.0
156
+ version: 2.7.0
144
157
  required_rubygems_version: !ruby/object:Gem::Requirement
145
158
  requirements:
146
159
  - - ">="
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "dry/logic/operations/and"
4
- require "dry/logic/operations/or"
5
- require "dry/logic/operations/xor"
6
- require "dry/logic/operations/implication"
7
- require "dry/logic/operations/negation"
8
-
9
- require "dry/logic/operations/key"
10
- require "dry/logic/operations/attr"
11
- require "dry/logic/operations/each"
12
- require "dry/logic/operations/set"
13
- require "dry/logic/operations/check"
14
-
15
- require "dry/logic/operators"