Skip to content

Commit

Permalink
Target new syntax in rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
flash-gordon committed Jan 3, 2025
1 parent 37bf502 commit ab0714a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# This is a config synced from dry-rb/template-gem repo

AllCops:
TargetRubyVersion: 3.0
NewCops: disable
TargetRubyVersion: 3.1
NewCops: enable
SuggestExtensions: false
Exclude:
- "**/vendor/**/*" # For GitHub Actions, see rubocop/rubocop#9832
Expand Down
8 changes: 4 additions & 4 deletions lib/dry/logic/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ module Builder
# p is_zero.call(1) # => false
# p is_zero.call(0) # => true
# p is_zero.call(-1) # => false
def call(&context)
Context.instance.call(&context)
def call(&)
Context.instance.call(&)
end
module_function :call
alias_method :build, :call
Expand All @@ -44,8 +44,8 @@ module Predicates
end

# @see Builder#call
def call(&context)
instance_eval(&context)
def call(&)
instance_eval(&)
end

# Defines custom predicate
Expand Down
2 changes: 1 addition & 1 deletion lib/dry/logic/operations/check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Check < Unary

def self.new(rule, **options)
if options[:evaluator]
super(rule, **options)
super
else
keys = options.fetch(:keys)
evaluator = Evaluator::Set.new(keys)
Expand Down
8 changes: 4 additions & 4 deletions lib/dry/logic/predicates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,12 @@ def uuid_v8?(input)
end

def uri?(schemes, input)
uri_format = URI::DEFAULT_PARSER.make_regexp(schemes)
uri_format = ::URI::DEFAULT_PARSER.make_regexp(schemes)
format?(uri_format, input)
end

def uri_rfc3986?(input)
format?(URI::RFC3986_Parser::RFC3986_URI, input)
format?(::URI::RFC3986_Parser::RFC3986_URI, input)
end

# This overrides Object#respond_to? so we need to make it compatible
Expand All @@ -287,8 +287,8 @@ def respond_to?(method, input = Undefined)
input.respond_to?(method)
end

def predicate(name, &block)
define_singleton_method(name, &block)
def predicate(name, &)
define_singleton_method(name, &)
end

def deprecated(name, in_favor_of)
Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

SPEC_ROOT = Pathname(__dir__)

Dir[SPEC_ROOT.join("shared/**/*.rb")].sort.each(&method(:require))
Dir[SPEC_ROOT.join("support/**/*.rb")].sort.each(&method(:require))
Dir[SPEC_ROOT.join("shared/**/*.rb")].each(&method(:require))
Dir[SPEC_ROOT.join("support/**/*.rb")].each(&method(:require))

RSpec.configure do |config|
config.include Module.new {
Expand Down

0 comments on commit ab0714a

Please sign in to comment.