Граф коммитов

16 Коммитов

Автор SHA1 Сообщение Дата
Jeremy Evans 0dcd3340fb
[ruby/forwardable] Make def_*_delegator return name of method defined (Fixes #10)
This restores compatibility with previous versions.  This behavior
was previously undefined, but it makes sense for the name of the
defined method to be returned.

https://github.com/ruby/forwardable/commit/a52ef3451e
2019-12-11 20:23:53 +09:00
Jeremy Evans 9fa0166a58 [ruby/forwardable] Fix keyword argument separation warnings on Ruby 2.7+
Do so in a way that is also compatible with previous versions.

https://github.com/ruby/forwardable/commit/b2dd340988
2019-11-30 15:53:42 +09:00
Kazuhiro NISHIYAMA f625a4be3c [ruby/forwardable] Fix NoMethodError on ruby 2.4 or earlier
https://github.com/ruby/forwardable/runs/242918994#step:5:12
```
Error: test_obj_single_delegators_send_id(TestForwardable): NoMethodError: private method `attr_reader' called for #<Class:#<Object:0x00005605af501f58>>
```

https://github.com/ruby/forwardable/commit/711bbb2466
2019-10-26 09:25:17 +09:00
Jeremy Evans d00551a7bb [ruby/forwardable] Make def_{instance,single}_delegators skip :__send__ and :__id__
Previously, __send__ and __id__ were skipped if provided as strings,
but not skipped if provided as symbols.

Fixes Ruby Bug 8855.

https://github.com/ruby/forwardable/commit/2e61c8c66c
2019-10-26 09:25:06 +09:00
Jeremy Evans 4b7d7d007f Document and add spec for delegating to constants in Forwardable
Fixes [Bug #13142]
2019-07-26 07:35:58 -07:00
hsbt 499658abff Add test for Forwardable#def_delegator with r55366.
Patch by @aycabta
  [Bug #12837][ruby-core:77611]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-01 09:07:16 +00:00
shyouhei 58c5011b3e * test/test_forwardable.rb (TestForwardable#test_on_private_method): add test for [Bug #12782] [Bug #12840]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-31 08:43:54 +00:00
nobu e8700ab03d forwardable.rb: backtrace
* 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/trunk@55372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-11 00:31:30 +00:00
nobu 094a3b1162 test_forwardable.rb: operators
* test/test_forwardable.rb: add tests for operators.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-10 16:01:25 +00:00
nobu b661824e75 forwardable.rb: fix for non-module objects
* 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/trunk@55366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-10 12:54:25 +00:00
nobu 6fd18ca51b forwardable.rb: adjust backtrace by tail call
* 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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30 02:28:59 +00:00
nobu d8eb5ade4f fix commit miss
* test/test_forwardable.rb: add tests for r53381.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30 02:26:15 +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