__FILE__
returns the path of the current Ruby script file.
One potentially significant problem is that, if using binding.pry
, __FILE__
evaluates to (pry)
. It is potentially problematic to have __FILE__
evaluate to different values depending on whether it is evaluated in the context of binding.pry
. For example,
$stdout.print "****************************************\n\n"
$stdout.print "FILE: #{__FILE__}\n\n"
$stdout.print "****************************************\n\n"
binding.pry
When the script pauses at binding.pry
, I get:
__FILE__
# >> (pry)
Does anyone know any mechanism to get the path of the current file even in the context of binding.pry
?