Issue #6287 has been updated by shyouhei (Shyouhei Urabe).

Description updated

I know what you mean, but I think this is a limitation of Ruby's OOP nature.  In Ruby, everything belongs to an object.  So a method must belong to an object, not another method.
----------------------------------------
Feature #6287: nested method should only be visible by nesting/enclosing method
https://bugs.ruby-lang.org/issues/6287#change-25878

Author: botp (bot pena)
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: 2.0.0



> def test1
  def test2
    p "i am test2"
  end
  test2
  end

 
>  test1
  "i am test2"  # ok

>  test2   
  "i am test2"  # not ok (imho), this should fail; ie test2 should only be visible by test1, not by outside.





-- 
http://bugs.ruby-lang.org/