2024-08-03 01:18:22 +01:00

23 lines
388 B
Ruby

# typed: true
# frozen_string_literal: true
require "irb"
module IRB
def self.start_within(binding)
old_stdout_sync = $stdout.sync
$stdout.sync = true
unless @setup_done
setup(nil, argv: [])
@setup_done = true
end
workspace = WorkSpace.new(binding)
irb = Irb.new(workspace)
irb.run(conf)
ensure
$stdout.sync = old_stdout_sync
end
end