Skip to content

Instantly share code, notes, and snippets.

@fxn
Last active June 13, 2016 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fxn/9e43cb7abc3bfdb7718d06f72389cbf9 to your computer and use it in GitHub Desktop.
Save fxn/9e43cb7abc3bfdb7718d06f72389cbf9 to your computer and use it in GitHub Desktop.
load File.expand_path('2.rb') # decomposed in 2.3
require_relative '3'
def inspect_caller_location
puts caller_locations.first.absolute_path
p caller_locations.first.absolute_path.bytes
end
inspect_caller_location # prints a decomposed variant or the full path to 3.rb
require_relative '4'
load Dir.pwd + '/5.rb' # composed
require_relative '6'
inspect_caller_location # prints a composed variant or the full path to 6.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment