Class: Byebug::LocalInterface

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

Overview

Interface class for standard byebug use.

Constant Summary collapse

EOF_ALIAS =
'continue'

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.



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

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. If Ctrl-D is pressed, it returns “continue”.

Parameters:

  • prompt

    Prompt to be displayed.



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

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