Sha256: 4b26b8a94f03786c30ee360a895d7c62ad8cd5159a0351d5e29f7c4a46361be7

Contents?: true

Size: 597 Bytes

Versions: 27

Compression:

Stored size: 597 Bytes

Contents

module Byebug
  #
  # Interface class for command execution from script files.
  #
  class ScriptInterface < Interface
    def initialize(file, verbose = false)
      super()
      @input = File.open(file)
      @output = verbose ? STDOUT : StringIO.new
      @error = verbose ? STDERR : StringIO.new
    end

    def read_command(prompt)
      readline(prompt, false)
    end

    def close
      input.close
    end

    def readline(*)
      while (result = input.gets)
        output.puts "+ #{result}"
        next if result =~ /^\s*#/
        return result.chomp
      end
    end
  end
end

Version data entries

27 entries across 26 versions & 3 rubygems

Version Path
byebug-5.0.0 lib/byebug/interfaces/script_interface.rb
byebug-4.0.5 lib/byebug/interfaces/script_interface.rb
byebug-4.0.4 lib/byebug/interfaces/script_interface.rb
byebug-4.0.3 lib/byebug/interfaces/script_interface.rb
byebug-4.0.2 lib/byebug/interfaces/script_interface.rb
byebug-4.0.1 lib/byebug/interfaces/script_interface.rb
byebug-4.0.0 lib/byebug/interfaces/script_interface.rb