Project

General

Profile

ActionsLike0

Bug #11571

closed

シングルトンメソッドの中で def を使用した時の可視性が変わっている

Added by hsbt (Hiroshi SHIBATA) over 9 years ago. Updated over 9 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-10-05 trunk 52041)
[ruby-dev:<unknown>]

Description

以下のコードの可視性が 2.3 と 2.2 で異なっているようです

https://github.com/radar/paranoia/blob/rails4/lib/paranoia.rb#L189

ruby 2.3.0dev (2015-10-05 trunk 52041) では private,
ruby 2.2.4p179 (2015-10-05 revision 52032) では public になります。

意図しない非互換な変更と思いますので修正をお願いします。


Related issues 1 (0 open1 closed)

Related to Ruby - Bug #13249: Access modifiers don't have an effect inside class methods in Ruby >= 2.3Closednobu (Nobuyoshi Nakada)Actions

Added by ko1 (Koichi Sasada) over 9 years ago

Revision 25f5dd67

  • vm.c (vm_define_method): do not use current CREF immediately,
    but check CREF in environment or methods. Methods defined in methods
    should be public.
    [Bug #11571]

  • vm_method.c (rb_scope_module_func_check): check CREF in env or me.
    if CREF is contained by `me', then return FALSE.

  • test/ruby/test_method.rb: add a test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

ActionsLike0

Also available in: Atom PDF