Class: Iwoca::PathSanitizer

Inherits:
Object
  • Object
show all
Defined in:
lib/iwoca/path_sanitizer.rb

Class Method Summary collapse

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