Module | Breakpoint::CommandBundle |
In: |
lib/breakpoint.rb
|
These commands are automatically available in all breakpoint shells.
Lets an object that will forward method calls to the breakpoint client. This is useful for outputting longer things at the client and so on. You can for example do these things:
client.puts "Hello" # outputs "Hello" at client console # outputs "Hello" into the file temp.txt at the client client.File.open("temp.txt", "w") { |f| f.puts "Hello" }
# File lib/breakpoint.rb, line 196 196: def client() 197: if Breakpoint.use_drb? then 198: sleep(0.5) until Breakpoint.drb_service.eval_handler 199: Client.new(Breakpoint.drb_service.eval_handler) 200: else 201: Client.new(lambda { |code| eval(code, TOPLEVEL_BINDING) }) 202: end 203: end
Returns the source code surrounding the location where the breakpoint was issued.
# File lib/breakpoint.rb, line 173 173: def source_lines(context = 5, return_line_numbers = false) 174: lines = File.readlines(@__bp_file).map { |line| line.chomp } 175: 176: break_line = @__bp_line 177: start_line = [break_line - context, 1].max 178: end_line = break_line + context 179: 180: result = lines[(start_line - 1) .. (end_line - 1)] 181: 182: if return_line_numbers then 183: return [start_line, break_line, result] 184: else 185: return result 186: end 187: end