lib/byebug/context.rb in byebug-7.0.0 vs lib/byebug/context.rb in byebug-8.0.0
- old
+ new
@@ -37,38 +37,36 @@
@processor ||= CommandProcessor
end
end
#
- # Tells whether a file is ignored by the debugger.
+ # Reader for the current frame
#
- # @param path [String] filename to be checked.
- #
- def ignored_file?(path)
- self.class.ignored_files.include?(path)
- end
-
def frame
@frame ||= Frame.new(self, 0)
end
+ #
+ # Writer for the current frame
+ #
def frame=(pos)
@frame = Frame.new(self, pos)
end
- def file
- frame.file
- end
+ extend Forwardable
+ def_delegators :frame, :file, :line
- def line
- frame.line
- end
-
+ #
+ # Current file & line information
+ #
def location
"#{normalize(file)}:#{line}"
end
+ #
+ # Current file, line and source code information
+ #
def full_location
return location if virtual_file?(file)
"#{location} #{get_line(file, line)}"
end
@@ -86,39 +84,72 @@
def interrupt
step_into 1
end
- def at_breakpoint(breakpoint)
- processor.at_breakpoint(breakpoint)
- end
+ #
+ # Line handler
+ #
+ def at_line
+ self.frame = 0
+ return if ignored_file?(file)
- def at_catchpoint(exception)
- processor.at_catchpoint(exception)
+ processor.at_line
end
+ #
+ # Tracing handler
+ #
def at_tracing
return if ignored_file?(file)
processor.at_tracing
end
- def at_line
- self.frame = 0
- return if ignored_file?(file)
+ #
+ # Breakpoint handler
+ #
+ def at_breakpoint(breakpoint)
+ processor.at_breakpoint(breakpoint)
+ end
- processor.at_line
+ #
+ # Catchpoint handler
+ #
+ def at_catchpoint(exception)
+ processor.at_catchpoint(exception)
end
+ #
+ # Return handler
+ #
def at_return(return_value)
return if ignored_file?(file)
processor.at_return(return_value)
end
+ #
+ # End of class definition handler
+ #
+ def at_end
+ return if ignored_file?(file)
+
+ processor.at_end
+ end
+
private
def processor
@processor ||= self.class.processor.new(self)
+ end
+
+ #
+ # Tells whether a file is ignored by the debugger.
+ #
+ # @param path [String] filename to be checked.
+ #
+ def ignored_file?(path)
+ self.class.ignored_files.include?(path)
end
end
end