Bug #704

delegate.rb will only delegate to specifically-named delegate object

Added by erikh (Erik Hollensbe) over 3 years ago. Updated about 1 year ago.

[ruby-core:19671]
Status:Closed Start date:11/01/2008
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:1.9.1 Release Candidate
ruby -v:

Description

long story short, I needed to redefine __getobj__ and __setobj__ for a porting effort for a class that inherited from DelegateClass. The new ivar that __getobj__ and __setobj__ accessed was not able to be used by Delegator.delegating_block because the ivar is assumed to be named what the default is, and __send__ is called against that.

Included is a patch which uses __getobj__ to get that value instead.

patch.gz (274 Bytes) erikh (Erik Hollensbe), 11/01/2008 07:56 am

Associated revisions

Revision 20169
Added by matz (Yukihiro Matsumoto) over 3 years ago

* lib/delegate.rb (Delegator.delegating_block): should not refer DelegateClass specific @delegate_dc_obj. a patch from Erik Hollensbe in [ruby-core:19671].

History

Updated by matz (Yukihiro Matsumoto) over 3 years ago

  • Status changed from Open to Closed
fixed by r15376

Updated by erikh (Erik Hollensbe) over 3 years ago

I don't think this is actually fixed, it still uses @delegate_dc_obj instead of using the value returned by __getobj__ to call __send__ against.

Updated by matz (Yukihiro Matsumoto) over 3 years ago

Oops, I misunderstood, because your patch was reversed patch (new -> old).
My bad.

Updated by erikh (Erik Hollensbe) over 3 years ago

Oh crap. :) Sorry about that. Thanks.

Also available in: Atom PDF