ruby / delegate

This library provides three different ways to delegate method calls to an object.
BSD 2-Clause "Simplified" License
18 stars 13 forks source link

Fix `DelegateClass` block "method redefined" warning #13

Closed jonathanhefner closed 2 years ago

jonathanhefner commented 2 years ago

This commit prevents "method redefined" warnings when overriding methods within a DelegateClass block, such as in the following example:

  Base = Class.new do
    def foo
      "foo"
    end
  end

  Overridden = DelegateClass(Base) do
    def foo
      super + "!"
    end
  end

Fixes https://bugs.ruby-lang.org/issues/19047.