ruby-changes:32715
From: naruse <ko1@a...>
Date: Sun, 2 Feb 2014 22:46:54 +0900 (JST)
Subject: [ruby-changes:32715] naruse:r44794 (ruby_2_1): merge revision(s) 44630, 44631: [Backport #9403]
naruse 2014-02-02 22:46:46 +0900 (Sun, 02 Feb 2014) New Revision: 44794 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44794 Log: merge revision(s) 44630,44631: [Backport #9403] * lib/delegate.rb (Delegator): keep source information methods which start and end with '__'. [ruby-core:58572] [Bug #9155] which start and end with '__'. [ruby-core:59718] [Bug #9403] Modified directories: branches/ruby_2_1/ Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/lib/delegate.rb branches/ruby_2_1/test/test_delegate.rb branches/ruby_2_1/version.h Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 44793) +++ ruby_2_1/ChangeLog (revision 44794) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Sun Feb 2 22:39:28 2014 Nobuyoshi Nakada <nobu@r...> + + * lib/delegate.rb (Delegator): keep source information methods + which start and end with '__'. [ruby-core:59718] [Bug #9403] + Fri Jan 31 12:10:16 2014 Nobuyoshi Nakada <nobu@r...> * proc.c (mnew_from_me): keep iclass as-is, to make inheritance Index: ruby_2_1/lib/delegate.rb =================================================================== --- ruby_2_1/lib/delegate.rb (revision 44793) +++ ruby_2_1/lib/delegate.rb (revision 44794) @@ -48,7 +48,7 @@ class Delegator < BasicObject https://github.com/ruby/ruby/blob/trunk/ruby_2_1/lib/delegate.rb#L48 undef_method m end private_instance_methods.each do |m| - if /\Ablock_given\?\z|iterator\?\z|\A__raise__\z/ =~ m + if /\Ablock_given\?\z|iterator\?\z|\A__.*__\z/ =~ m next end undef_method m Index: ruby_2_1/version.h =================================================================== --- ruby_2_1/version.h (revision 44793) +++ ruby_2_1/version.h (revision 44794) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.1" -#define RUBY_RELEASE_DATE "2014-02-01" -#define RUBY_PATCHLEVEL 14 +#define RUBY_RELEASE_DATE "2014-02-02" +#define RUBY_PATCHLEVEL 15 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 2 -#define RUBY_RELEASE_DAY 1 +#define RUBY_RELEASE_DAY 2 #include "ruby/version.h" Index: ruby_2_1/test/test_delegate.rb =================================================================== --- ruby_2_1/test/test_delegate.rb (revision 44793) +++ ruby_2_1/test/test_delegate.rb (revision 44794) @@ -180,4 +180,61 @@ class TestDelegateClass < Test::Unit::Te https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/test_delegate.rb#L180 x = assert_nothing_raised(ArgumentError, bug9155) {break Bug9155.new(1)} assert_equal(1, x.to_i, bug9155) end + + class Bug9403 + Name = '[ruby-core:59718] [Bug #9403]' + SD = SimpleDelegator.new(new) + class << SD + def method_name + __method__ + end + def callee_name + __callee__ + end + alias aliased_name callee_name + def dir_name + __dir__ + end + end + dc = DelegateClass(self) + dc.class_eval do + def method_name + __method__ + end + def callee_name + __callee__ + end + alias aliased_name callee_name + def dir_name + __dir__ + end + end + DC = dc.new(new) + end + + def test_method_in_simple_delegator + assert_equal(:method_name, Bug9403::SD.method_name, Bug9403::Name) + end + + def test_callee_in_simple_delegator + assert_equal(:callee_name, Bug9403::SD.callee_name, Bug9403::Name) + assert_equal(:aliased_name, Bug9403::SD.aliased_name, Bug9403::Name) + end + + def test_dir_in_simple_delegator + assert_equal(__dir__, Bug9403::SD.dir_name, Bug9403::Name) + end + + def test_method_in_delegator_class + assert_equal(:method_name, Bug9403::DC.method_name, Bug9403::Name) + end + + def test_callee_in_delegator_class + assert_equal(:callee_name, Bug9403::DC.callee_name, Bug9403::Name) + assert_equal(:aliased_name, Bug9403::DC.aliased_name, Bug9403::Name) + end + + def test_dir_in_delegator_class + assert_equal(__dir__, Bug9403::DC.dir_name, Bug9403::Name) + end end Property changes on: ruby_2_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r44630-44631 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/