diff options
author | wyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-06-09 17:06:24 +0000 |
---|---|---|
committer | wyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-06-09 17:06:24 +0000 |
commit | 09a7d0173b672e9ba2e0062bf23acbf232afe1cc (patch) | |
tree | a461b65281fdcdeb1e505800b3230c5d2703e1cc /lib | |
parent | 0881fce5165127bff80a0d861b8a0c226b6c8408 (diff) |
lib/delegate.rb: Backport #1781 [ruby-core:24356]; allow a block to be properly passed through.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@28239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/delegate.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/delegate.rb b/lib/delegate.rb index ee5fe8d7fe..66119caaa3 100644 --- a/lib/delegate.rb +++ b/lib/delegate.rb @@ -152,12 +152,12 @@ class Delegator alias initialize_methods initialize # Handles the magic of delegation through \_\_getobj\_\_. - def method_missing(m, *args) + def method_missing(m, *args, &block) target = self.__getobj__ unless target.respond_to?(m) - super(m, *args) + super(m, *args, &block) end - target.__send__(m, *args) + target.__send__(m, *args, &block) end # @@ -265,11 +265,11 @@ def DelegateClass(superclass) def initialize(obj) # :nodoc: @_dc_obj = obj end - def method_missing(m, *args) # :nodoc: + def method_missing(m, *args, &block) # :nodoc: unless @_dc_obj.respond_to?(m) - super(m, *args) + super(m, *args, &block) end - @_dc_obj.__send__(m, *args) + @_dc_obj.__send__(m, *args, &block) end def respond_to?(m, include_private = false) # :nodoc: return true if super |