class Byebug::ScriptInterface - byebug-11.0.1 Documentation

# 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 8
    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 20
    def close
      input.close
    end

read_command(prompt) click to toggle source

    # File lib/byebug/interfaces/script_interface.rb, line 16
    def read_command(prompt)
      readline(prompt, false)
    end

readline(*) click to toggle source

    # File lib/byebug/interfaces/script_interface.rb, line 24
    def readline(*)
      while (result = input.gets)
        output.puts "+ #{result}" if @verbose
        next if result =~ /^\s*#/

        return result.chomp
      end
    end