mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
dd889fac19
commit
d3bb9ea112
2 changed files with 12 additions and 7 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Mar 31 11:52:39 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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 <akr@m17n.org>
|
Tue Mar 30 20:25:34 2004 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
* time.c (search_time_t): limit guess range by mktime if it is
|
* time.c (search_time_t): limit guess range by mktime if it is
|
||||||
|
|
|
@ -91,6 +91,12 @@ def DelegateClass(superclass)
|
||||||
def initialize(obj)
|
def initialize(obj)
|
||||||
@_dc_obj = obj
|
@_dc_obj = obj
|
||||||
end
|
end
|
||||||
|
def __getobj__
|
||||||
|
@_dc_obj
|
||||||
|
end
|
||||||
|
def __setobj__(obj)
|
||||||
|
@_dc_obj = obj
|
||||||
|
end
|
||||||
EOS
|
EOS
|
||||||
for method in methods
|
for method in methods
|
||||||
begin
|
begin
|
||||||
|
@ -108,13 +114,7 @@ def DelegateClass(superclass)
|
||||||
raise NameError, "invalid identifier %s" % method, caller(3)
|
raise NameError, "invalid identifier %s" % method, caller(3)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def __getobj__
|
return klass
|
||||||
@_dc_obj
|
|
||||||
end
|
|
||||||
def __setobj__(obj)
|
|
||||||
@_dc_obj = obj
|
|
||||||
end
|
|
||||||
return klass;
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if __FILE__ == $0
|
if __FILE__ == $0
|
||||||
|
|
Loading…
Add table
Reference in a new issue