Module: PryByebug::Helpers::Location

Included in:
BreakCommand, ContinueCommand
Defined in:
lib/pry-byebug/helpers/location.rb

Overview

Compatibility helper to handle source location

Class Method Summary collapse

Class Method Details

.current_file(source = target) ⇒ Object

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



15
16
17
18
19
20
21
# File 'lib/pry-byebug/helpers/location.rb', line 15

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