Project

General

Profile

Actions

Bug #11571

closed

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

Added by hsbt (Hiroshi SHIBATA) about 9 years ago. Updated about 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 master - Bug #13249: Access modifiers don't have an effect inside class methods in Ruby >= 2.3Closednobu (Nobuyoshi Nakada)Actions
Actions #1

Updated by ko1 (Koichi Sasada) about 9 years ago

  • Status changed from Open to Closed

Applied in changeset r52562.


  • 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.

Actions #2

Updated by nobu (Nobuyoshi Nakada) over 7 years ago

  • Related to Bug #13249: Access modifiers don't have an effect inside class methods in Ruby >= 2.3 added
Actions

Also available in: Atom PDF

Like0
Like0Like0