diff options
author | takkanm <takkanm@gmail.com> | 2018-06-19 20:49:09 +0900 |
---|---|---|
committer | Kazuhiro NISHIYAMA <znz@users.noreply.github.com> | 2019-10-11 09:33:25 +0900 |
commit | 87958520f3fd7fdec18c3508888b3d2a4e5c27a4 (patch) | |
tree | 2a3cac5fd84f7fe771dc6dfaea68dd9a154ad409 /lib/irb.rb | |
parent | 29c1e9a0d4c855781853f0ad41b0125f42cf504d (diff) |
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__.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/1896
Diffstat (limited to 'lib/irb.rb')
-rw-r--r-- | lib/irb.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/irb.rb b/lib/irb.rb index a41d4e13be..522b53f762 100644 --- a/lib/irb.rb +++ b/lib/irb.rb @@ -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 |