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, #print, #puts, #read_command, #read_file, #read_input

Methods included from FileFunctions

#get_line, #get_lines, #n_lines, #normalize

Constructor Details

#initializeLocalInterface

Returns a new instance of LocalInterface.


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

def initialize
  super()
  @input, @output, @error = STDIN, STDOUT, 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.


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

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