* lib/delegate.rb (DelegateClass): restored 1.8 behavior for
DelegateClass as well. [ruby-dev:36739] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
55ae1d90a3
commit
7a0acc7eee
@ -1,3 +1,8 @@
|
||||
Wed Oct 15 23:11:10 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* lib/delegate.rb (DelegateClass): restored 1.8 behavior for
|
||||
DelegateClass as well. [ruby-dev:36739]
|
||||
|
||||
Wed Oct 15 22:19:14 2008 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* array.c (RESIZE_CAPA): check whether len is longer than capacity.
|
||||
|
@ -119,7 +119,6 @@ class Delegator
|
||||
undef_method m
|
||||
end
|
||||
|
||||
module MethodDelegation
|
||||
#
|
||||
# Pass in the _obj_ to delegate method calls to. All methods supported by
|
||||
# _obj_ will be delegated to.
|
||||
@ -198,8 +197,6 @@ class Delegator
|
||||
new
|
||||
end
|
||||
end
|
||||
include MethodDelegation
|
||||
end
|
||||
|
||||
#
|
||||
# A concrete implementation of Delegator, this class provides the means to
|
||||
@ -258,16 +255,11 @@ end
|
||||
# end
|
||||
#
|
||||
def DelegateClass(superclass)
|
||||
klass = Class.new
|
||||
klass = Class.new(Delegator)
|
||||
methods = superclass.public_instance_methods(true)
|
||||
methods -= [
|
||||
:__id__, :object_id, :__send__, :public_send, :respond_to?, :send,
|
||||
:==, :equal?, :initialize, :method_missing, :__getobj__, :__setobj__,
|
||||
:clone, :dup, :marshal_dump, :marshal_load, :instance_eval, :instance_exec,
|
||||
:extend,
|
||||
]
|
||||
methods -= ::Delegator.public_instance_methods
|
||||
methods -= [:to_s,:inspect,:=~,:!~,:===]
|
||||
klass.module_eval {
|
||||
include Delegator::MethodDelegation
|
||||
def __getobj__ # :nodoc:
|
||||
@delegate_dc_obj
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user