diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-31 02:52:44 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-31 02:52:44 +0000 |
commit | d3bb9ea1128c1f98b3aede3228f77a4d79241382 (patch) | |
tree | 6a2b0fd6bfcee7903f699a18e1d0d5c93190c455 /lib | |
parent | dd889fac191adcf34103443d6ea563d54dda0fb7 (diff) | |
download | ruby-d3bb9ea1128c1f98b3aede3228f77a4d79241382.tar.gz |
* 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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/delegate.rb | 14 |
1 files changed, 7 insertions, 7 deletions
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 |