Skip to content

Instantly share code, notes, and snippets.

@nathanl
Created August 8, 2014 19:10
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 nathanl/d94e44537ee39cea4413 to your computer and use it in GitHub Desktop.
Save nathanl/d94e44537ee39cea4413 to your computer and use it in GitHub Desktop.
Ruby `p` with location
def p(*args)
location = caller_locations(1,1)[0]
location_string = "#{location.path.split('/').last}:#{location.lineno}(#{location.label})"
super([*args, location_string])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment