Skip to content

Instantly share code, notes, and snippets.

@miguelbermudez
Forked from atduskgreg/gist:1244103
Created September 27, 2011 01:53
Show Gist options
  • Save miguelbermudez/1244106 to your computer and use it in GitHub Desktop.
Save miguelbermudez/1244106 to your computer and use it in GitHub Desktop.
file_locator.rb
puts "Called from: #{File.expand_path(File.dirname("."))}"
puts __FILE__
puts "last: " + File.dirname(__FILE__).split("/").last
puts pwd = File.expand_path(File.dirname(__FILE__))
puts "parent dir:"
ar = pwd.split("/")
puts "/#{ar[ar.length-2]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment