Class: Byebug::LocalInterface
- Defined in:
- lib/byebug/interface.rb
Constant Summary collapse
- FILE_HISTORY =
".byebug_hist"
Instance Attribute Summary collapse
-
#command_queue ⇒ Object
Returns the value of attribute command_queue.
-
#histfile ⇒ Object
Returns the value of attribute histfile.
-
#history_length ⇒ Object
Returns the value of attribute history_length.
-
#history_save ⇒ Object
Returns the value of attribute history_save.
-
#restart_file ⇒ Object
Returns the value of attribute restart_file.
Attributes inherited from Interface
Instance Method Summary collapse
- #close ⇒ Object
- #confirm(prompt) ⇒ Object
-
#finalize ⇒ Object
Things to do before quitting.
-
#initialize ⇒ LocalInterface
constructor
A new instance of LocalInterface.
-
#print(*args) ⇒ Object
Callers of this routine should make sure to use comma to separate format argments rather than %.
- #read_command(prompt) ⇒ Object
- #readline_support? ⇒ Boolean
Methods inherited from Interface
Constructor Details
#initialize ⇒ LocalInterface
Returns a new instance of LocalInterface.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/byebug/interface.rb', line 42 def initialize() super @command_queue = [] @have_readline = false @history_save = true # take gdb's default @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_queue ⇒ Object
Returns the value of attribute command_queue.
35 36 37 |
# File 'lib/byebug/interface.rb', line 35 def command_queue @command_queue end |
#histfile ⇒ Object
Returns the value of attribute histfile.
35 36 37 |
# File 'lib/byebug/interface.rb', line 35 def histfile @histfile end |
#history_length ⇒ Object
Returns the value of attribute history_length.
35 36 37 |
# File 'lib/byebug/interface.rb', line 35 def history_length @history_length end |
#history_save ⇒ Object
Returns the value of attribute history_save.
35 36 37 |
# File 'lib/byebug/interface.rb', line 35 def history_save @history_save end |
#restart_file ⇒ Object
Returns the value of attribute restart_file.
36 37 38 |
# File 'lib/byebug/interface.rb', line 36 def restart_file @restart_file end |
Instance Method Details
#close ⇒ Object
77 78 |
# File 'lib/byebug/interface.rb', line 77 def close end |
#confirm(prompt) ⇒ Object
64 65 66 |
# File 'lib/byebug/interface.rb', line 64 def confirm(prompt) readline(prompt, false) end |
#finalize ⇒ Object
Things to do before quitting
81 82 83 84 85 86 87 88 |
# File 'lib/byebug/interface.rb', line 81 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 |
#print(*args) ⇒ Object
Callers of this routine should make sure to use comma to separate format argments rather than %. Otherwise it seems that if the string you want to print has format specifier, which could happen if you are trying to show say a source-code line with “puts” or “print” in it, this print routine will give an error saying it is looking for more arguments.
73 74 75 |
# File 'lib/byebug/interface.rb', line 73 def print(*args) STDOUT.printf(*args) end |
#read_command(prompt) ⇒ Object
60 61 62 |
# File 'lib/byebug/interface.rb', line 60 def read_command(prompt) readline(prompt, true) end |
#readline_support? ⇒ Boolean
90 91 92 |
# File 'lib/byebug/interface.rb', line 90 def readline_support? @have_readline end |