class Byebug::ScriptInterface

Interface class for command execution from script files.

Public Class Methods

new(file, verbose = false) click to toggle source
Calls superclass method Byebug::Interface.new
# File lib/byebug/interfaces/script_interface.rb, line 7
def initialize(file, verbose = false)
  super()
  @verbose = verbose
  @input = File.open(file)
  @output = verbose ? $stdout : StringIO.new
  @error = $stderr
end

Public Instance Methods

close() click to toggle source
# File lib/byebug/interfaces/script_interface.rb, line 19
def close
  input.close
end
read_command(prompt) click to toggle source
# File lib/byebug/interfaces/script_interface.rb, line 15
def read_command(prompt)
  readline(prompt, false)
end
readline(*) click to toggle source
# File lib/byebug/interfaces/script_interface.rb, line 23
def readline(*)
  while (result = input.gets)
    output.puts "+ #{result}" if @verbose
    next if /^\s*#/.match?(result)

    return result.chomp
  end
end