Skip to content

Commit

Permalink
[ruby/delegate] Revert "Fix DelegateClass block "method redefined" …
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu authored and matzbot committed Dec 1, 2022
1 parent 4e68b59 commit a1d341e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
2 changes: 0 additions & 2 deletions lib/delegate.rb
Expand Up @@ -412,12 +412,10 @@ def __setobj__(obj) # :nodoc:
end
protected_instance_methods.each do |method|
define_method(method, Delegator.delegating_block(method))
alias_method(method, method)
protected method
end
public_instance_methods.each do |method|
define_method(method, Delegator.delegating_block(method))
alias_method(method, method)
end
end
klass.define_singleton_method :public_instance_methods do |all=true|
Expand Down
12 changes: 0 additions & 12 deletions test/test_delegate.rb
Expand Up @@ -29,18 +29,6 @@ def test_delegate_class_block
assert_equal(1, klass.new([1]).foo)
end

def test_delegate_class_block_with_override
warning = EnvUtil.verbose_warning do
klass = DelegateClass(Array) do
def first
super.inspect
end
end
assert_equal("1", klass.new([1]).first)
end
assert_empty(warning)
end

def test_systemcallerror_eq
e = SystemCallError.new(0)
assert((SimpleDelegator.new(e) == e) == (e == SimpleDelegator.new(e)), "[ruby-dev:34808]")
Expand Down

0 comments on commit a1d341e

Please sign in to comment.