basics/warn/uplevel_paths.rb

tests/_examples/basics/warn/uplevel_paths.rb in the metorex repository.

# A warning with `uplevel:` names the file the way it was given to ruby.
$stderr = $stdout

def caution
  warn "from the caller", uplevel: 1
end

caution
warn "from here", uplevel: 0

Output:

tests/_examples/basics/warn/uplevel_paths.rb:8: warning: from the caller
tests/_examples/basics/warn/uplevel_paths.rb:9: warning: from here