From 35a51b2538d49f3cf69d3fa7d4eef371ef336aaf Mon Sep 17 00:00:00 2001 From: knu Date: Sat, 9 May 2009 14:27:35 +0000 Subject: * lib/delegate.rb (Delegator#method_missing) (DelegateClass()#method_missing): Properly pass a given block through. [ruby-dev:38390] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ lib/delegate.rb | 12 ++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9841698673..1b7fef3f41 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat May 9 23:26:04 2009 Akinori MUSHA + + * lib/delegate.rb (Delegator#method_missing) + (DelegateClass()#method_missing): Properly pass a given block + through. [ruby-dev:38390] + Fri May 8 02:34:25 2009 Akinori MUSHA * lib/set.rb (SortedSet#add): Do not require each newly added diff --git a/lib/delegate.rb b/lib/delegate.rb index bd2b5e4813..43549946c9 100644 --- a/lib/delegate.rb +++ b/lib/delegate.rb @@ -151,12 +151,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 # @@ -264,11 +264,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 -- cgit v1.2.3