1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

set real path to __FILE__ and __dir__ in Binding#irb

When reading Binding#irb, the file of the calling source is reflected in __FILE__ and __dir__.
This commit is contained in:
takkanm 2018-06-19 20:49:09 +09:00 committed by Kazuhiro NISHIYAMA
parent 29c1e9a0d4
commit 87958520f3
Notes: git 2019-10-11 09:33:56 +09:00

View file

@ -850,6 +850,8 @@ class Binding
IRB.setup(source_location[0], argv: [])
workspace = IRB::WorkSpace.new(self)
STDOUT.print(workspace.code_around_binding)
IRB::Irb.new(workspace).run(IRB.conf)
binding_irb = IRB::Irb.new(workspace)
binding_irb.context.irb_path = File.expand_path(source_location[0])
binding_irb.run(IRB.conf)
end
end