Sha256: f29ec2190c644c6d2954c05cbe30f4fe2f7488ae7066a3c6f58fbc027a882958

Contents?: true

Size: 687 Bytes

Versions: 4

Compression:

Stored size: 687 Bytes

Contents

require 'byebug/history'

module Byebug
  #
  # Interface class for remote use of byebug.
  #
  class RemoteInterface < Interface
    attr_reader :history

    def initialize(socket)
      super()
      @socket = socket
      @history = History.new
    end

    def close
      @socket.close
    rescue IOError
    end

    def confirm(prompt)
      send_command "CONFIRM #{prompt}"
    end

    def read_command(prompt)
      send_command "PROMPT #{prompt}"
    end

    def puts(message)
      @socket.puts(message)
    end

    private

    def send_command(msg)
      @socket.puts msg
      result = @socket.gets
      fail IOError unless result
      result.chomp
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
byebug-3.4.2 lib/byebug/interfaces/remote_interface.rb
byebug-3.4.1 lib/byebug/interfaces/remote_interface.rb
byebug-3.4.0 lib/byebug/interfaces/remote_interface.rb
byebug-3.3.0 lib/byebug/interfaces/remote_interface.rb