Project

General

Profile

Actions

Bug #20342

closed

Top level `public`, `private` and `ruby2_keywords` do not work in wrapped load

Added by nobu (Nobuyoshi Nakada) 8 months ago. Updated 4 months ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:117200]

Description

With this file:

# load.rb
public def f = :ok

It is OK when required.

$ ruby -r ./load.rb -e 'p f'
:ok

Simple load is OK too.

$ ruby -e 'load ARGV[0]; p f' load.rb 
:ok

Wrapped load fails.

$ ruby -e 'load ARGV[0], true' load.rb 
load.rb:1:in 'public': undefined method 'f' for class 'Object' (NameError)

public def f = :ok
^^^^^^
	from load.rb:1:in '<top (required)>'
	from -e:1:in 'Kernel#load'
	from -e:1:in '<main>'
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0