Module: Zomgit::Helpers::FileHelper
- Included in:
- Commands::StatusCommand
- Defined in:
- lib/zomgit/helpers/file_helper.rb
Instance Method Summary collapse
Instance Method Details
#relative_path(base, target) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/zomgit/helpers/file_helper.rb', line 4 def relative_path(base, target) back = "" while target.sub(base, "") == target base = base.sub(/\/[^\/]*$/, "") back = "../#{back}" end "#{back}#{target.sub("#{base}/","")}" end |