Class: Byebug::LocalInterface

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

Constant Summary collapse

FILE_HISTORY =
".byebug_hist"

Instance Attribute Summary collapse

Attributes inherited from Interface

#have_readline

Instance Method Summary collapse

Methods inherited from Interface

#afmt, #aprint, #errmsg

Constructor Details

#initializeLocalInterface

Returns a new instance of LocalInterface.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/byebug/interface.rb', line 50

def initialize()
  super
  @command_queue = []
  @have_readline = false
  @history_save = true
  @history_length = ENV["HISTSIZE"] ? ENV["HISTSIZE"].to_i : 256
  @histfile = File.join(ENV["HOME"]||ENV["HOMEPATH"]||".", FILE_HISTORY)
  open(@histfile, 'r') do |file|
    file.each do |line|
      line.chomp!
      Readline::HISTORY << line
    end
  end if File.exist?(@histfile)
  @restart_file = nil
end

Instance Attribute Details

#command_queueObject

Returns the value of attribute command_queue.



45
46
47
# File 'lib/byebug/interface.rb', line 45

def command_queue
  @command_queue
end

#histfileObject

Returns the value of attribute histfile.



45
46
47
# File 'lib/byebug/interface.rb', line 45

def histfile
  @histfile
end

#history_lengthObject

Returns the value of attribute history_length.



45
46
47
# File 'lib/byebug/interface.rb', line 45

def history_length
  @history_length
end

#history_saveObject

Returns the value of attribute history_save.



45
46
47
# File 'lib/byebug/interface.rb', line 45

def history_save
  @history_save
end

#restart_fileObject

Returns the value of attribute restart_file.



46
47
48
# File 'lib/byebug/interface.rb', line 46

def restart_file
  @restart_file
end

Instance Method Details

#closeObject



78
79
# File 'lib/byebug/interface.rb', line 78

def close
end

#confirm(prompt) ⇒ Object



70
71
72
# File 'lib/byebug/interface.rb', line 70

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

#finalizeObject

Things to do before quitting



82
83
84
85
86
87
88
89
# File 'lib/byebug/interface.rb', line 82

def finalize
  if Byebug.method_defined?("annotate") and Byebug.annotate.to_i > 2
    print "\032\032exited\n\n"
  end
  if Byebug.respond_to?(:save_history)
    Byebug.save_history
  end
end


74
75
76
# File 'lib/byebug/interface.rb', line 74

def print(*args)
  STDOUT.printf(format(*args))
end

#read_command(prompt) ⇒ Object



66
67
68
# File 'lib/byebug/interface.rb', line 66

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

#readline_support?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/byebug/interface.rb', line 91

def readline_support?
  @have_readline
end