Class: Iwoca::PathSanitizer
- Inherits:
-
Object
- Object
- Iwoca::PathSanitizer
- Defined in:
- lib/iwoca/path_sanitizer.rb
Class Method Summary collapse
-
.sanitize(path) ⇒ Object
Removes any leading ‘/’ and guarantees an ending ‘/’.
Class Method Details
.sanitize(path) ⇒ Object
Removes any leading ‘/’ and guarantees an ending ‘/’
6 7 8 9 10 11 |
# File 'lib/iwoca/path_sanitizer.rb', line 6 def self.sanitize(path) parts = path.split('/').reject(&:empty?) new_path = parts.join('/') [new_path, '/'].join end |