Class: File
- Inherits:
-
Object
- Object
- File
- Defined in:
- lib/file.rb
Class Method Summary collapse
-
.sanitize_path(path) ⇒ Object
Removes all references to parent directories (../) in a path.
Class Method Details
.sanitize_path(path) ⇒ Object
Removes all references to parent directories (../) in a path.
path - The path to sanitize.
Returns a clean, pristine path.
7 8 9 |
# File 'lib/file.rb', line 7 def self.sanitize_path(path) path.gsub(/\.\.(?=$|\/)/, '') unless path.nil? end |