Class: Byebug::LocalInterface

Inherits:
Interface show all
Defined in:
lib/byebug/interfaces/local_interface.rb

Overview

Interface class for standard byebug use.

Instance Attribute Summary

Attributes inherited from Interface

#command_queue, #error, #history, #input, #output

Instance Method Summary collapse

Methods inherited from Interface

#autorestore, #autosave, #close, #confirm, #errmsg, #last_if_empty, #prepare_input, #print, #puts, #read_command, #read_file, #read_input

Methods included from Helpers::FileHelper

#get_line, #get_lines, #n_lines, #normalize, #shortpath, #virtual_file?

Constructor Details

#initializeLocalInterface

Returns a new instance of LocalInterface.



6
7
8
9
10
11
# File 'lib/byebug/interfaces/local_interface.rb', line 6

def initialize
  super()
  @input = STDIN
  @output = STDOUT
  @error = STDERR
end

Instance Method Details

#readline(prompt) ⇒ Object

Reads a single line of input using Readline. If Ctrl-C is pressed in the middle of input, the line is reset to only the prompt and we ask for input again.

Parameters:

  • prompt

    Prompt to be displayed.



20
21
22
23
24
25
# File 'lib/byebug/interfaces/local_interface.rb', line 20

def readline(prompt)
  Readline.readline(prompt, false)
rescue Interrupt
  puts('^C')
  retry
end