зеркало из https://github.com/github/ruby.git
* 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:
Родитель
dd889fac19
Коммит
d3bb9ea112
|
@ -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>
|
||||
|
||||
* time.c (search_time_t): limit guess range by mktime if it is
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче