Class: Bringit::PathHelper
- Inherits:
-
Object
- Object
- Bringit::PathHelper
- Defined in:
- lib/bringit/path_helper.rb
Class Method Summary collapse
Class Method Details
.normalize_path(filename) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/bringit/path_helper.rb', line 4 def normalize_path(filename) # Strip all leading slashes so that //foo -> foo filename = filename.sub(/^\/*/, '') # Expand relative paths (e.g. foo/../bar) filename = Pathname.new(filename) filename.relative_path_from(Pathname.new('')) end |