Module: IRB

Defined in:
debrew/irb.rb

Class Method Summary collapse

Class Method Details

.start_within(binding) ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

This method returns an undefined value.

Parameters:

  • binding (Binding)


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'debrew/irb.rb', line 8

def self.start_within(binding)
  old_stdout_sync = $stdout.sync
  $stdout.sync = true

  @setup_done ||= T.let(false, T.nilable(T::Boolean))
  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