Project

General

Profile

Bug #19067

Updated by shioyama (Chris Salzberg) over 1 year ago

```ruby 
 #foo.rb  
 module Foo 
 end 
 private_constant :Foo 
 ``` 

 ```ruby 
 module MyModule; end 
 load "./foo.rb", MyModule 
 # undefined method `private_constant' for main:Object (NoMethodError) 
 #                                             
 # private_constant :Foo                       
 # ^^^^^^^^^^^^^^^^                            
 # Did you mean?    private_methods 
 ``` 

 However, this works: 

 ```ruby 
 module MyModule 
   module Foo 
   end 
   private_constant :Foo 
 end 
 ``` 

 `load` loads the code under the `wrap` module, so this seems like a bug to me. 

 See: https://bugs.ruby-lang.org/issues/19024#note-23

Back