Class: Youlend::PathSanitizer

Inherits:
Object
  • Object
show all
Defined in:
lib/youlend/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/youlend/path_sanitizer.rb', line 6

def self.sanitize(path)
  parts = path.split('/').reject(&:empty?)
  new_path = parts.join('/')

  [new_path, '/'].join
end