23 lines
388 B
Ruby
Raw Normal View History

2020-10-10 14:16:11 +02:00
# typed: true
# frozen_string_literal: true
require "irb"
module IRB
2020-09-20 05:57:37 +02:00
def self.start_within(binding)
2024-08-03 01:16:58 +01:00
old_stdout_sync = $stdout.sync
$stdout.sync = true
2020-09-20 05:57:37 +02:00
unless @setup_done
setup(nil, argv: [])
@setup_done = true
end
2020-09-20 05:57:37 +02:00
workspace = WorkSpace.new(binding)
irb = Irb.new(workspace)
2024-08-03 01:16:58 +01:00
irb.run(conf)
ensure
$stdout.sync = old_stdout_sync
2020-09-20 05:57:37 +02:00
end
end