Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package rubygem-dry-logic for
openSUSE:Factory checked in at 2022-10-30 18:28:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-dry-logic (Old)
and /work/SRC/openSUSE:Factory/.rubygem-dry-logic.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-dry-logic"
Sun Oct 30 18:28:47 2022 rev:5 rq:1032138 version:1.3.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-dry-logic/rubygem-dry-logic.changes
2021-07-02 13:28:33.104255640 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-dry-logic.new.2275/rubygem-dry-logic.changes
2022-10-30 18:28:56.494418620 +0100
@@ -1,0 +2,30 @@
+Fri Oct 28 04:55:31 UTC 2022 - Stephan Kulow <[email protected]>
+
+updated to version 1.3.0
+ see installed CHANGELOG.md
+
+ ## unreleased
+
+
+ ### Added
+
+ - `uri_rfc3986?` predicate that uses a better regexp than `uri?` (see #94
for more details) (@hieuk09)
+
+ ### Changed
+
+ - Deprecate `eql?` in favor of `is_eql?` (issue #92 via #98) (@solnic)
+ - Deprecate `respond_to?` in favor of `interface?` (issue #73 closed via
#99) (@solnic)
+
+ [Compare
v1.3.0...master](https://github.com/dry-rb/dry-logic/compare/v1.3.0...master)
+
+ ## 1.3.0 2022-10-15
+
+
+ ### Changed
+
+ - Use zeitwerk for auto-loading (@solnic + @flash-gordon)
+
+ [Compare
v1.2.0...v1.3.0](https://github.com/dry-rb/dry-logic/compare/v1.2.0...v1.3.0)
+
+
+-------------------------------------------------------------------
Old:
----
dry-logic-1.2.0.gem
New:
----
dry-logic-1.3.0.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-dry-logic.spec ++++++
--- /var/tmp/diff_new_pack.kMAM9V/_old 2022-10-30 18:28:58.854431373 +0100
+++ /var/tmp/diff_new_pack.kMAM9V/_new 2022-10-30 18:28:58.862431417 +0100
@@ -1,7 +1,7 @@
#
# spec file for package rubygem-dry-logic
#
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -24,12 +24,12 @@
#
Name: rubygem-dry-logic
-Version: 1.2.0
+Version: 1.3.0
Release: 0
%define mod_name dry-logic
%define mod_full_name %{mod_name}-%{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-BuildRequires: %{ruby >= 2.5.0}
+BuildRequires: %{ruby >= 2.7.0}
BuildRequires: %{rubygem gem2rpm}
BuildRequires: ruby-macros >= 5
URL: https://dry-rb.org/gems/dry-logic
++++++ dry-logic-1.2.0.gem -> dry-logic-1.3.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md 2021-04-26 08:24:21.000000000 +0200
+++ new/CHANGELOG.md 2022-10-15 07:25:13.000000000 +0200
@@ -1,5 +1,28 @@
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
+## unreleased
+
+
+### Added
+
+- `uri_rfc3986?` predicate that uses a better regexp than `uri?` (see #94 for
more details) (@hieuk09)
+
+### Changed
+
+- Deprecate `eql?` in favor of `is_eql?` (issue #92 via #98) (@solnic)
+- Deprecate `respond_to?` in favor of `interface?` (issue #73 closed via #99)
(@solnic)
+
+[Compare
v1.3.0...master](https://github.com/dry-rb/dry-logic/compare/v1.3.0...master)
+
+## 1.3.0 2022-10-15
+
+
+### Changed
+
+- Use zeitwerk for auto-loading (@solnic + @flash-gordon)
+
+[Compare
v1.2.0...v1.3.0](https://github.com/dry-rb/dry-logic/compare/v1.2.0...v1.3.0)
+
## 1.2.0 2021-04-26
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/LICENSE new/LICENSE
--- old/LICENSE 2021-04-26 08:24:21.000000000 +0200
+++ new/LICENSE 2022-10-15 07:25:13.000000000 +0200
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2015-2021 dry-rb team
+Copyright (c) 2015-2022 dry-rb team
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md 2021-04-26 08:24:21.000000000 +0200
+++ new/README.md 2022-10-15 07:25:13.000000000 +0200
@@ -1,3 +1,4 @@
+<!--- this file is synced from dry-rb/template-gem project -->
[gem]: https://rubygems.org/gems/dry-logic
[actions]: https://github.com/dry-rb/dry-logic/actions
[codacy]: https://www.codacy.com/gh/dry-rb/dry-logic
@@ -10,19 +11,19 @@
[][actions]
[][codacy]
[][codacy]
-[][inchpages]
+[][inchpages]
## Links
-* [User documentation](http://dry-rb.org/gems/dry-logic)
+* [User documentation](https://dry-rb.org/gems/dry-logic)
* [API documentation](http://rubydoc.info/gems/dry-logic)
## Supported Ruby versions
This library officially supports the following Ruby versions:
-* MRI >= `2.5`
-* jruby >= `9.2`
+* MRI `>= 2.7.0`
+* jruby `>= 9.3` (postponed until 2.7 is supported)
## License
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/dry-logic.gemspec new/dry-logic.gemspec
--- old/dry-logic.gemspec 2021-04-26 08:24:21.000000000 +0200
+++ new/dry-logic.gemspec 2022-10-15 07:25:13.000000000 +0200
@@ -1,35 +1,37 @@
# frozen_string_literal: true
-# this file is managed by dry-rb/devtools project
-lib = File.expand_path('lib', __dir__)
+# this file is synced from dry-rb/template-gem project
+
+lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
-require 'dry/logic/version'
+require "dry/logic/version"
Gem::Specification.new do |spec|
- spec.name = 'dry-logic'
+ spec.name = "dry-logic"
spec.authors = ["Piotr Solnica"]
spec.email = ["[email protected]"]
- spec.license = 'MIT'
+ spec.license = "MIT"
spec.version = Dry::Logic::VERSION.dup
spec.summary = "Predicate logic with rule composition"
spec.description = spec.summary
- spec.homepage = 'https://dry-rb.org/gems/dry-logic'
+ spec.homepage = "https://dry-rb.org/gems/dry-logic"
spec.files = Dir["CHANGELOG.md", "LICENSE", "README.md",
"dry-logic.gemspec", "lib/**/*"]
- spec.bindir = 'bin'
+ spec.bindir = "bin"
spec.executables = []
- spec.require_paths = ['lib']
+ spec.require_paths = ["lib"]
- spec.metadata['allowed_push_host'] = 'https://rubygems.org'
- spec.metadata['changelog_uri'] =
'https://github.com/dry-rb/dry-logic/blob/master/CHANGELOG.md'
- spec.metadata['source_code_uri'] = 'https://github.com/dry-rb/dry-logic'
- spec.metadata['bug_tracker_uri'] =
'https://github.com/dry-rb/dry-logic/issues'
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
+ spec.metadata["changelog_uri"] =
"https://github.com/dry-rb/dry-logic/blob/main/CHANGELOG.md"
+ spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-logic"
+ spec.metadata["bug_tracker_uri"] =
"https://github.com/dry-rb/dry-logic/issues"
- spec.required_ruby_version = ">= 2.5.0"
+ spec.required_ruby_version = ">= 2.7.0"
# to update dependencies edit project.yml
spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
- spec.add_runtime_dependency "dry-core", "~> 0.5", ">= 0.5"
+ spec.add_runtime_dependency "dry-core", "~> 0.9", ">= 0.9"
+ spec.add_runtime_dependency "zeitwerk", "~> 2.6"
spec.add_development_dependency "bundler"
spec.add_development_dependency "rake"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/builder.rb new/lib/dry/logic/builder.rb
--- old/lib/dry/logic/builder.rb 2021-04-26 08:24:21.000000000 +0200
+++ new/lib/dry/logic/builder.rb 2022-10-15 07:25:13.000000000 +0200
@@ -1,13 +1,10 @@
# frozen_string_literal: true
-require "dry/logic"
require "singleton"
require "delegate"
module Dry
module Logic
- autoload :Operations, "dry/logic/operations"
- autoload :Predicates, "dry/logic/predicates"
module Builder
IGNORED_OPERATIONS = %i[
Abstract
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/evaluator.rb
new/lib/dry/logic/evaluator.rb
--- old/lib/dry/logic/evaluator.rb 2021-04-26 08:24:21.000000000 +0200
+++ new/lib/dry/logic/evaluator.rb 2022-10-15 07:25:13.000000000 +0200
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require "dry/core/equalizer"
-
module Dry
module Logic
class Evaluator
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/operations/abstract.rb
new/lib/dry/logic/operations/abstract.rb
--- old/lib/dry/logic/operations/abstract.rb 2021-04-26 08:24:21.000000000
+0200
+++ new/lib/dry/logic/operations/abstract.rb 2022-10-15 07:25:13.000000000
+0200
@@ -1,9 +1,5 @@
# frozen_string_literal: true
-require "dry/core/constants"
-require "dry/core/equalizer"
-require "dry/logic/operators"
-
module Dry
module Logic
module Operations
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/operations/and.rb
new/lib/dry/logic/operations/and.rb
--- old/lib/dry/logic/operations/and.rb 2021-04-26 08:24:21.000000000 +0200
+++ new/lib/dry/logic/operations/and.rb 2022-10-15 07:25:13.000000000 +0200
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-require "dry/logic/operations/binary"
-require "dry/logic/result"
-
module Dry
module Logic
module Operations
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/operations/attr.rb
new/lib/dry/logic/operations/attr.rb
--- old/lib/dry/logic/operations/attr.rb 2021-04-26 08:24:21.000000000
+0200
+++ new/lib/dry/logic/operations/attr.rb 2022-10-15 07:25:13.000000000
+0200
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require "dry/logic/operations/key"
-
module Dry
module Logic
module Operations
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/operations/binary.rb
new/lib/dry/logic/operations/binary.rb
--- old/lib/dry/logic/operations/binary.rb 2021-04-26 08:24:21.000000000
+0200
+++ new/lib/dry/logic/operations/binary.rb 2022-10-15 07:25:13.000000000
+0200
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require "dry/logic/operations/abstract"
-
module Dry
module Logic
module Operations
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/operations/check.rb
new/lib/dry/logic/operations/check.rb
--- old/lib/dry/logic/operations/check.rb 2021-04-26 08:24:21.000000000
+0200
+++ new/lib/dry/logic/operations/check.rb 2022-10-15 07:25:13.000000000
+0200
@@ -1,9 +1,5 @@
# frozen_string_literal: true
-require "dry/logic/operations/unary"
-require "dry/logic/evaluator"
-require "dry/logic/result"
-
module Dry
module Logic
module Operations
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/operations/each.rb
new/lib/dry/logic/operations/each.rb
--- old/lib/dry/logic/operations/each.rb 2021-04-26 08:24:21.000000000
+0200
+++ new/lib/dry/logic/operations/each.rb 2022-10-15 07:25:13.000000000
+0200
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-require "dry/logic/operations/unary"
-require "dry/logic/result"
-
module Dry
module Logic
module Operations
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/operations/implication.rb
new/lib/dry/logic/operations/implication.rb
--- old/lib/dry/logic/operations/implication.rb 2021-04-26 08:24:21.000000000
+0200
+++ new/lib/dry/logic/operations/implication.rb 2022-10-15 07:25:13.000000000
+0200
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-require "dry/logic/operations/binary"
-require "dry/logic/result"
-
module Dry
module Logic
module Operations
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/operations/key.rb
new/lib/dry/logic/operations/key.rb
--- old/lib/dry/logic/operations/key.rb 2021-04-26 08:24:21.000000000 +0200
+++ new/lib/dry/logic/operations/key.rb 2022-10-15 07:25:13.000000000 +0200
@@ -1,9 +1,5 @@
# frozen_string_literal: true
-require "dry/logic/operations/unary"
-require "dry/logic/evaluator"
-require "dry/logic/result"
-
module Dry
module Logic
module Operations
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/operations/negation.rb
new/lib/dry/logic/operations/negation.rb
--- old/lib/dry/logic/operations/negation.rb 2021-04-26 08:24:21.000000000
+0200
+++ new/lib/dry/logic/operations/negation.rb 2022-10-15 07:25:13.000000000
+0200
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-require "dry/logic/operations/unary"
-require "dry/logic/result"
-
module Dry
module Logic
module Operations
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/operations/or.rb
new/lib/dry/logic/operations/or.rb
--- old/lib/dry/logic/operations/or.rb 2021-04-26 08:24:21.000000000 +0200
+++ new/lib/dry/logic/operations/or.rb 2022-10-15 07:25:13.000000000 +0200
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-require "dry/logic/operations/binary"
-require "dry/logic/result"
-
module Dry
module Logic
module Operations
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/operations/set.rb
new/lib/dry/logic/operations/set.rb
--- old/lib/dry/logic/operations/set.rb 2021-04-26 08:24:21.000000000 +0200
+++ new/lib/dry/logic/operations/set.rb 2022-10-15 07:25:13.000000000 +0200
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-require "dry/logic/operations/abstract"
-require "dry/logic/result"
-
module Dry
module Logic
module Operations
@@ -16,7 +13,7 @@
success = results.all?(&:success?)
Result.new(success, id) do
- [type, results.select(&:failure?).map { |failure| failure.to_ast }]
+ [type, results.select(&:failure?).map(&:to_ast)]
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/operations/unary.rb
new/lib/dry/logic/operations/unary.rb
--- old/lib/dry/logic/operations/unary.rb 2021-04-26 08:24:21.000000000
+0200
+++ new/lib/dry/logic/operations/unary.rb 2022-10-15 07:25:13.000000000
+0200
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require "dry/logic/operations/abstract"
-
module Dry
module Logic
module Operations
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/operations/xor.rb
new/lib/dry/logic/operations/xor.rb
--- old/lib/dry/logic/operations/xor.rb 2021-04-26 08:24:21.000000000 +0200
+++ new/lib/dry/logic/operations/xor.rb 2022-10-15 07:25:13.000000000 +0200
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-require "dry/logic/operations/binary"
-require "dry/logic/result"
-
module Dry
module Logic
module Operations
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/operations.rb
new/lib/dry/logic/operations.rb
--- old/lib/dry/logic/operations.rb 2021-04-26 08:24:21.000000000 +0200
+++ new/lib/dry/logic/operations.rb 1970-01-01 01:00:00.000000000 +0100
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-require "dry/logic/operations/and"
-require "dry/logic/operations/or"
-require "dry/logic/operations/xor"
-require "dry/logic/operations/implication"
-require "dry/logic/operations/negation"
-
-require "dry/logic/operations/key"
-require "dry/logic/operations/attr"
-require "dry/logic/operations/each"
-require "dry/logic/operations/set"
-require "dry/logic/operations/check"
-
-require "dry/logic/operators"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/predicates.rb
new/lib/dry/logic/predicates.rb
--- old/lib/dry/logic/predicates.rb 2021-04-26 08:24:21.000000000 +0200
+++ new/lib/dry/logic/predicates.rb 2022-10-15 07:25:13.000000000 +0200
@@ -7,7 +7,24 @@
module Dry
module Logic
module Predicates
+ # rubocop:disable Metrics/ModuleLength
module Methods
+ def self.uuid_format(version)
+ ::Regexp.new(<<~FORMAT.chomp, ::Regexp::IGNORECASE)
+
\\A[0-9A-F]{8}-[0-9A-F]{4}-#{version}[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}\\z
+ FORMAT
+ end
+
+ UUIDv1 = uuid_format(1)
+
+ UUIDv2 = uuid_format(2)
+
+ UUIDv3 = uuid_format(3)
+
+ UUIDv4 = uuid_format(4)
+
+ UUIDv5 = uuid_format(5)
+
def [](name)
method(name)
end
@@ -203,32 +220,29 @@
end
def case?(pattern, input)
+ # rubocop:disable Style/CaseEquality
pattern === input
+ # rubocop:enable Style/CaseEquality
end
def uuid_v1?(input)
- 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
- format?(uuid_v1_format, input)
+ format?(UUIDv1, input)
end
def uuid_v2?(input)
- 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
- format?(uuid_v2_format, input)
+ format?(UUIDv2, input)
end
def uuid_v3?(input)
- 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
- format?(uuid_v3_format, input)
+ format?(UUIDv3, input)
end
def uuid_v4?(input)
- 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
- format?(uuid_v4_format, input)
+ format?(UUIDv4, input)
end
def uuid_v5?(input)
- 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
- format?(uuid_v5_format, input)
+ format?(UUIDv5, input)
end
def uri?(schemes, input)
@@ -236,6 +250,10 @@
format?(uri_format, input)
end
+ def uri_rfc3986?(input)
+ format?(URI::RFC3986_Parser::RFC3986_URI, input)
+ end
+
def respond_to?(method, input)
input.respond_to?(method)
end
@@ -252,5 +270,6 @@
other.extend(Methods)
end
end
+ # rubocop:enable Metrics/ModuleLength
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/result.rb new/lib/dry/logic/result.rb
--- old/lib/dry/logic/result.rb 2021-04-26 08:24:21.000000000 +0200
+++ new/lib/dry/logic/result.rb 2022-10-15 07:25:13.000000000 +0200
@@ -1,12 +1,8 @@
# frozen_string_literal: true
-require "dry/core/constants"
-
module Dry
module Logic
class Result
- include Core::Constants
-
SUCCESS = Class.new {
def success?
true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/rule/interface.rb
new/lib/dry/logic/rule/interface.rb
--- old/lib/dry/logic/rule/interface.rb 2021-04-26 08:24:21.000000000 +0200
+++ new/lib/dry/logic/rule/interface.rb 2022-10-15 07:25:13.000000000 +0200
@@ -11,6 +11,8 @@
attr_reader :curried
def initialize(arity, curried)
+ super()
+
@arity = arity
@curried = curried
@@ -84,11 +86,11 @@
end
module_eval(<<~RUBY, __FILE__, __LINE__ + 1)
- def initialize(*)
- super
-
- #{assignment}
- end
+ def initialize(*) # def initialize(*)
+ super # super
+ #
+ #{assignment} # @arg0 = @args[0]
+ end # end
RUBY
end
@@ -114,17 +116,17 @@
application = "@predicate[#{(curried_args + unapplied_args +
splat).join(", ")}]"
module_eval(<<~RUBY, __FILE__, __LINE__ + 1)
- def call(#{parameters})
- if #{application}
- Result::SUCCESS
- else
- Result.new(false, id) { ast(#{parameters}) }
- end
- end
-
- def [](#{parameters})
- #{application}
- end
+ def call(#{parameters}) #
def call(input0, input1, *rest)
+ if #{application} #
if @predicate[@arg0, @arg1, input0, input1, *rest]
+ Result::SUCCESS #
::Dry::Logic::Result::Success
+ else #
else
+ Result.new(false, id) { ast(#{parameters}) } #
::Dry::Logic::Result.new(false, id) { ast(input0, input1, *rest) }
+ end #
end
+ end #
end
+ #
+ def [](#{parameters}) #
def [](@arg0, @arg1, input0, input1, *rest)
+ #{application} #
@predicate[@arg0, @arg1, input0, input1, *rest]
+ end #
end
RUBY
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/rule/predicate.rb
new/lib/dry/logic/rule/predicate.rb
--- old/lib/dry/logic/rule/predicate.rb 2021-04-26 08:24:21.000000000 +0200
+++ new/lib/dry/logic/rule/predicate.rb 2022-10-15 07:25:13.000000000 +0200
@@ -1,34 +1,34 @@
# frozen_string_literal: true
-require "dry/logic/rule"
-
module Dry
module Logic
- class Rule::Predicate < Rule
- def self.specialize(arity, curried, base = Predicate)
- super
- end
+ class Rule
+ class Predicate < Rule
+ def self.specialize(arity, curried, base = Predicate)
+ super
+ end
- def type
- :predicate
- end
+ def type
+ :predicate
+ end
- def name
- predicate.name
- end
+ def name
+ predicate.name
+ end
- def to_s
- if args.size > 0
- "#{name}(#{args.map(&:inspect).join(", ")})"
- else
- name.to_s
+ def to_s
+ if args.empty?
+ name.to_s
+ else
+ "#{name}(#{args.map(&:inspect).join(", ")})"
+ end
end
- end
- def ast(input = Undefined)
- [type, [name, args_with_names(input)]]
+ def ast(input = Undefined)
+ [type, [name, args_with_names(input)]]
+ end
+ alias_method :to_ast, :ast
end
- alias_method :to_ast, :ast
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/rule.rb new/lib/dry/logic/rule.rb
--- old/lib/dry/logic/rule.rb 2021-04-26 08:24:21.000000000 +0200
+++ new/lib/dry/logic/rule.rb 2022-10-15 07:25:13.000000000 +0200
@@ -1,11 +1,6 @@
# frozen_string_literal: true
require "concurrent/map"
-require "dry/core/constants"
-require "dry/core/equalizer"
-require "dry/logic/operations"
-require "dry/logic/result"
-require "dry/logic/rule/interface"
module Dry
module Logic
@@ -78,7 +73,7 @@
end
def eval_args(object)
- with(args: args.map { |arg| UnboundMethod === arg ?
arg.bind(object).() : arg })
+ with(args: args.map { |arg| arg.is_a?(UnboundMethod) ?
arg.bind(object).() : arg })
end
def with(new_opts)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/rule_compiler.rb
new/lib/dry/logic/rule_compiler.rb
--- old/lib/dry/logic/rule_compiler.rb 2021-04-26 08:24:21.000000000 +0200
+++ new/lib/dry/logic/rule_compiler.rb 2022-10-15 07:25:13.000000000 +0200
@@ -1,15 +1,8 @@
# frozen_string_literal: true
-require "dry/core/constants"
-
-require "dry/logic/rule"
-require "dry/logic/rule/predicate"
-
module Dry
module Logic
class RuleCompiler
- include Core::Constants
-
attr_reader :predicates
def initialize(predicates)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic/version.rb new/lib/dry/logic/version.rb
--- old/lib/dry/logic/version.rb 2021-04-26 08:24:21.000000000 +0200
+++ new/lib/dry/logic/version.rb 2022-10-15 07:25:13.000000000 +0200
@@ -2,6 +2,6 @@
module Dry
module Logic
- VERSION = "1.2.0"
+ VERSION = "1.3.0"
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dry/logic.rb new/lib/dry/logic.rb
--- old/lib/dry/logic.rb 2021-04-26 08:24:21.000000000 +0200
+++ new/lib/dry/logic.rb 2022-10-15 07:25:13.000000000 +0200
@@ -1,11 +1,25 @@
# frozen_string_literal: true
-# A collection of micro-libraries, each intended to encapsulate
-# a common task in Ruby
+require "zeitwerk"
+require "dry/core"
+
module Dry
module Logic
+ include Dry::Core::Constants
+
+ def self.loader
+ @loader ||= Zeitwerk::Loader.new.tap do |loader|
+ root = File.expand_path("..", __dir__)
+ loader.tag = "dry-logic"
+ loader.inflector = Zeitwerk::GemInflector.new("#{root}/dry-logic.rb")
+ loader.push_dir(root)
+ loader.ignore(
+ "#{root}/dry-logic.rb",
+ "#{root}/dry/logic/version.rb"
+ )
+ end
+ end
+
+ loader.setup
end
end
-
-require "dry/logic/rule/predicate"
-require "dry/logic/operations"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2021-04-26 08:24:21.000000000 +0200
+++ new/metadata 2022-10-15 07:25:13.000000000 +0200
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: dry-logic
version: !ruby/object:Gem::Version
- version: 1.2.0
+ version: 1.3.0
platform: ruby
authors:
- Piotr Solnica
-autorequire:
+autorequire:
bindir: bin
cert_chain: []
-date: 2021-04-26 00:00:00.000000000 Z
+date: 2022-10-15 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: concurrent-ruby
@@ -30,20 +30,34 @@
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: '0.5'
+ version: '0.9'
- - ">="
- !ruby/object:Gem::Version
- version: '0.5'
+ version: '0.9'
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: '0.5'
+ version: '0.9'
- - ">="
- !ruby/object:Gem::Version
- version: '0.5'
+ version: '0.9'
+- !ruby/object:Gem::Dependency
+ name: zeitwerk
+ requirement: !ruby/object:Gem::Requirement
+ requirements:
+ - - "~>"
+ - !ruby/object:Gem::Version
+ version: '2.6'
+ type: :runtime
+ prerelease: false
+ version_requirements: !ruby/object:Gem::Requirement
+ requirements:
+ - - "~>"
+ - !ruby/object:Gem::Version
+ version: '2.6'
- !ruby/object:Gem::Dependency
name: bundler
requirement: !ruby/object:Gem::Requirement
@@ -102,7 +116,6 @@
- lib/dry/logic/appliable.rb
- lib/dry/logic/builder.rb
- lib/dry/logic/evaluator.rb
-- lib/dry/logic/operations.rb
- lib/dry/logic/operations/abstract.rb
- lib/dry/logic/operations/and.rb
- lib/dry/logic/operations/attr.rb
@@ -129,10 +142,10 @@
- MIT
metadata:
allowed_push_host: https://rubygems.org
- changelog_uri: https://github.com/dry-rb/dry-logic/blob/master/CHANGELOG.md
+ changelog_uri: https://github.com/dry-rb/dry-logic/blob/main/CHANGELOG.md
source_code_uri: https://github.com/dry-rb/dry-logic
bug_tracker_uri: https://github.com/dry-rb/dry-logic/issues
-post_install_message:
+post_install_message:
rdoc_options: []
require_paths:
- lib
@@ -140,15 +153,15 @@
requirements:
- - ">="
- !ruby/object:Gem::Version
- version: 2.5.0
+ version: 2.7.0
required_rubygems_version: !ruby/object:Gem::Requirement
requirements:
- - ">="
- !ruby/object:Gem::Version
version: '0'
requirements: []
-rubygems_version: 3.1.6
-signing_key:
+rubygems_version: 3.3.7
+signing_key:
specification_version: 4
summary: Predicate logic with rule composition
test_files: []