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 коммит произвёл Kazuhiro NISHIYAMA
Родитель 29c1e9a0d4
Коммит 87958520f3
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -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