From e7d2b51c724f4d92800a2fd352594b46451548b0 Mon Sep 17 00:00:00 2001 From: Nikita Shilnikov Date: Sat, 4 Jan 2025 15:24:50 +0100 Subject: [PATCH] Remove ruby2_keywords --- lib/dry/system/component.rb | 5 ++--- lib/dry/system/loader.rb | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/dry/system/component.rb b/lib/dry/system/component.rb index fc8a72e0..65227843 100644 --- a/lib/dry/system/component.rb +++ b/lib/dry/system/component.rb @@ -60,10 +60,9 @@ def loadable? # # @return [Object] component's class instance # @api public - def instance(*args) - options[:instance]&.call(self, *args) || loader.call(self, *args) + def instance(*args, **kwargs) + options[:instance]&.call(self, *args, **kwargs) || loader.call(self, *args, **kwargs) end - ruby2_keywords(:instance) if respond_to?(:ruby2_keywords, true) # Returns the component's unique key # diff --git a/lib/dry/system/loader.rb b/lib/dry/system/loader.rb index ca5f1c43..78d1f55c 100644 --- a/lib/dry/system/loader.rb +++ b/lib/dry/system/loader.rb @@ -43,18 +43,17 @@ def require!(component) # @return [Object] # # @api public - def call(component, *args) + def call(component, *args, **kwargs) require!(component) constant = self.constant(component) if singleton?(constant) - constant.instance(*args) + constant.instance(*args, **kwargs) else - constant.new(*args) + constant.new(*args, **kwargs) end end - ruby2_keywords(:call) if respond_to?(:ruby2_keywords, true) # Returns the component's class constant #