class Byebug::ScriptInterface - byebug-4.0.5 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 6
    def initialize(file, verbose = false)
      super()
      @input = File.open(file)
      @output = verbose ? STDOUT : StringIO.new
      @error = verbose ? STDERR : StringIO.new
    end

### Public Instance Methods

close() click to toggle source

    # File lib/byebug/interfaces/script_interface.rb, line 17
    def close
      input.close
    end

read_command(prompt) click to toggle source

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

readline(*) click to toggle source

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