Skip to content

Commit

Permalink
Remove ruby2_keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
flash-gordon committed Jan 3, 2025
1 parent b4c723a commit 62bf6b3
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions lib/dry/core/memoizable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def inherited(base)
module BasicObject
include Base

def new(*)
def new(*, **)
obj = super
obj.instance_eval { @__memoized__ = MEMOIZED_HASH.dup }
obj
Expand All @@ -33,15 +33,11 @@ def new(*)
module Object
include Base

def new(*)
def new(*, **)
obj = super
obj.instance_variable_set(:@__memoized__, MEMOIZED_HASH.dup)
obj
end

if respond_to?(:ruby2_keywords, true)
ruby2_keywords(:new)
end
end
end

Expand Down Expand Up @@ -77,7 +73,6 @@ def initialize(klass, names)

# @api private
# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/PerceivedComplexity
def define_memoizable(method:)
parameters = method.parameters
mod = self
Expand Down Expand Up @@ -134,7 +129,7 @@ def #{method.name} # def slow_calc
WARN
end

m = module_eval(<<~RUBY, __FILE__, __LINE__ + 1)
module_eval(<<~RUBY, __FILE__, __LINE__ + 1)
def #{method.name}(#{params.join(", ")}) # def slow_calc(arg1, arg2, arg3)
key = [:"#{method.name}", #{binds.join(", ")}].hash # key = [:slow_calc, arg1, arg2, arg3].hash
#
Expand All @@ -146,16 +141,10 @@ def #{method.name}(#{params.join(", ")}) # def slow_calc(arg1, a
end # end
RUBY

if respond_to?(:ruby2_keywords, true) && mapping.key?(:reyrest)
ruby2_keywords(method.name)
end

m
end
end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/PerceivedComplexity

# rubocop:enable Metrics/AbcSize
# @api private
def declaration(definition, lookup)
params = []
Expand Down

0 comments on commit 62bf6b3

Please sign in to comment.