-
-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Labels
Description
Describe the bug
When using the :monitoring
plugin to monitor objects, the monitoring proxy fails to forward keyword arguments correctly. This causes an ArgumentError
when calling methods that accept keyword arguments on monitored objects.
To Reproduce
class MyContainer < Dry::System::Container
use :monitoring
configure do |config|
config.root = __dir__
end
end
# Register a component with a method that uses keyword arguments
class UserService
def greet(name, greeting: "Hello", punctuation: "!")
"#{greeting} #{name}#{punctuation}"
end
end
MyContainer.register(:user_service, UserService.new)
# Enable monitoring
MyContainer.monitor(:user_service) { puts _1 }
user_service = MyContainer[:user_service]
user_service.greet("Alice", greeting: "Hi", punctuation: "!!!")
# => ArgumentError: wrong number of arguments (given 2, expected 1)
Expected behavior
The method call should succeed and return "Hi Alice!!!"
, with the keyword arguments properly forwarded to the underlying object.
My environment
- Affects my production application: NO
- Ruby version: 3.4.2
- OS: arch linux