Commit graph

7 commits

Author SHA1 Message Date
usa
bec19f4962 merge revision(s) 55372: [Backport #14179]
* lib/forwardable.rb (_delegator_method): leave the backtrace
	  untouched during accessor.  forwardable.rb does not appear in
	  the backtrace during delegated method because of tail-call
	  optimization.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-18 15:04:49 +00:00
nagachika
1034b6d23d merge revision(s) 53383,55366: [Backport #12478]
* lib/forwardable.rb (def_instance_delegator): adjust backtrace of
	  method body by tail call optimization.  adjusting the delegated
	  target is still done by deleting backtrace.

	* lib/forwardable.rb (def_single_delegator): ditto.

	* lib/forwardable.rb (Forwardable._delegator_method): extract
	  method generator and deal with non-module objects.
	  [ruby-dev:49656] [Bug #12478]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@57570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-07 17:18:46 +00:00
nagachika
69dc2ce664 merge revision(s) 53382,53511,53512: [Backport #11916]
fix commit miss

	* test/test_forwardable.rb: add tests for r53381.
	* lib/forwardable.rb: Convert given accessors to String.
	  r53381 changed to accept only Symbol or String for accessors, but
	  there are several rubygems that pass classes (e.g. Array,
	  Hash, ...) as accessors. Prior r53381, it was accepted because Class#to_s
	  returns its class name. After r53381 given accessors are checked
	  with define_method, but it accepts only Symbol or String, otherwise
	  raises TypeError.
	      def_delegator Foo, :some_method
	  This change is to revert unwanted incompatibility. But this behavior
	  may change in the future.
	  This change is to revert unexpected incompatibility. But this behavior


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-22 15:24:35 +00:00
naruse
3e92b635fb Add frozen_string_literal: false for all files
When you change this to true, you may need to add more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
nobu
4e1ee809bb forwardable.rb: full qualify names
* lib/forwardable.rb (def_instance_delegator, def_single_delegator):
  match backtraces against ::Forwardable in case the target class
  is a subclass of BasicObject and does not include Kernel.
  [ruby-core:71176] [Bug #11616]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-23 22:29:14 +00:00
shugo
8c8e17d499 * lib/forwardable (def_instance_delegator, def_single_delegator):
rescue ::Exception instead of Exception in case Exception is
  defined under the target class.
  [ruby-core:71175] [Ruby trunk - Bug #11615]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-23 15:41:04 +00:00
hsbt
d92470bbc2 * test/test_forwardable.rb: Write basic tests for lib/forwardable.
[fix GH-1035] Patch by @kachick

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-28 01:31:17 +00:00