From d3bb9ea1128c1f98b3aede3228f77a4d79241382 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 31 Mar 2004 02:52:44 +0000 Subject: [PATCH] * lib/delegate.rb (DelegateClass): define internal methods of the result class, but not metaclass of the caller. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/delegate.rb | 14 +++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6e450009df..6755bf400f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Mar 31 11:52:39 2004 Nobuyoshi Nakada + + * lib/delegate.rb (DelegateClass): define internal methods of the + result class, but not metaclass of the caller. + Tue Mar 30 20:25:34 2004 Tanaka Akira * time.c (search_time_t): limit guess range by mktime if it is diff --git a/lib/delegate.rb b/lib/delegate.rb index cccaea8570..6e2637393f 100644 --- a/lib/delegate.rb +++ b/lib/delegate.rb @@ -91,6 +91,12 @@ def DelegateClass(superclass) def initialize(obj) @_dc_obj = obj end + def __getobj__ + @_dc_obj + end + def __setobj__(obj) + @_dc_obj = obj + end EOS for method in methods begin @@ -108,13 +114,7 @@ def DelegateClass(superclass) raise NameError, "invalid identifier %s" % method, caller(3) end end - def __getobj__ - @_dc_obj - end - def __setobj__(obj) - @_dc_obj = obj - end - return klass; + return klass end if __FILE__ == $0