From e2d078151921a692cd620e3c76ab5dcb1d4ff0e9 Mon Sep 17 00:00:00 2001 From: Nikita Shilnikov Date: Fri, 15 Mar 2024 13:22:43 +0100 Subject: [PATCH] Remove existing `with` on mixing in Initializer (closes #684, #687) So that it doesn't clash with the new "feature" from AS, namely, Object#with --- core/lib/rom/initializer.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/lib/rom/initializer.rb b/core/lib/rom/initializer.rb index 355dfa144..6c105a320 100644 --- a/core/lib/rom/initializer.rb +++ b/core/lib/rom/initializer.rb @@ -47,9 +47,13 @@ def with(**new_options) # @api private def self.extended(base) - base.extend(Dry::Initializer[undefined: false]) - base.extend(DefineWithHook) - base.include(InstanceMethods) + base.module_eval do + undef_method(:with) if method_defined?(:with) + + extend(Dry::Initializer[undefined: false]) + extend(DefineWithHook) + include(InstanceMethods) + end end # @api private