From e1797bc7dd2178550cf15d7a6af4f7f0eae003b4 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 6 Oct 2009 13:07:12 +0000 Subject: [PATCH] * lib/delegate.rb (Delegator::public_api): take snapshot of public method at the beginning time. * lib/delegate.rb (SimpleDelegator#initialize): use Delegator.public_api since public_method might be added after initialization. [ruby-dev:39383] * lib/delegate.rb (DelegateClass): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 +++++++++++ lib/delegate.rb | 18 +++++++++++++++++- test/test_delegate.rb | 22 ++++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c1de680ef8..512b915c6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,17 @@ Tue Oct 6 06:26:00 2009 Hidetoshi NAGAI * ext/tk/lib/tk/canvas.rb, ext/tk/lib/tkextlib/blt/component.rb: lack of support for methodcall_optkeys. +Mon Oct 5 17:19:33 2009 Yukihiro Matsumoto + + * lib/delegate.rb (Delegator::public_api): take snapshot of + public method at the beginning time. + + * lib/delegate.rb (SimpleDelegator#initialize): use + Delegator.public_api since public_method might be added after + initialization. [ruby-dev:39383] + + * lib/delegate.rb (DelegateClass): ditto. + Mon Oct 5 12:22:12 2009 Yukihiro Matsumoto * array.c (rb_ary_{times, shuffle_bang, sample}): reducing macro diff --git a/lib/delegate.rb b/lib/delegate.rb index d0b732aa8d..57c479c61b 100644 --- a/lib/delegate.rb +++ b/lib/delegate.rb @@ -196,6 +196,11 @@ class Delegator new.__setobj__(__getobj__.dup) new end + + @delegator_api = self.public_instance_methods + def self.public_api # :nodoc: + @delegator_api + end end # @@ -228,6 +233,17 @@ class SimpleDelegator