module PryByebug::Helpers::Location

Compatibility helper to handle source location

Public Instance Methods

current_file(source = target) click to toggle source

Current file in the target binding. Used as the default breakpoint location.

# File lib/pry-byebug/helpers/location.rb, line 14
def current_file(source = target)
  # Guard clause for Ruby >= 2.6 providing now Binding#source_location ...
  return source.source_location[0] if source.respond_to?(:source_location)

  # ... to avoid warning: 'eval may not return location in binding'
  source.eval("__FILE__")
end