diff --git a/lib/dry/effects/initializer.rb b/lib/dry/effects/initializer.rb index 5831d6e..af25562 100644 --- a/lib/dry/effects/initializer.rb +++ b/lib/dry/effects/initializer.rb @@ -17,7 +17,7 @@ def param(*) # @api private def option(*) super.tap do - __define_with__ unless method_defined?(:with) + __define_with__ unless with_method_defined? @has_options = true end end @@ -48,7 +48,7 @@ def __define_with__ seq_names << ", " unless seq_names.empty? - undef_method(:with) if method_defined?(:with) + undef_method(:with) if with_method_defined? class_eval(<<-RUBY, __FILE__, __LINE__ + 1) def with(**new_options) # def with(**new_options) @@ -60,6 +60,10 @@ def with(**new_options) # def with(**new_opti end # end RUBY end + + def with_method_defined? + (instance_methods - superclass.instance_methods).include?(:with) + end end # @api private