Sha256: c75bd0a0dc6f7ad8eb0e4c71a46590ce42b383199da936fb7620a17a11af3a79

Contents?: true

Size: 281 Bytes

Versions: 8

Compression:

Stored size: 281 Bytes

Contents

# frozen_string_literal: true

module Youlend
  class PathSanitizer
    # Removes any leading '/' and guarantees an ending '/'
    def self.sanitize(path)
      parts = path.split('/').reject(&:empty?)
      new_path = parts.join('/')

      [new_path, '/'].join
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
youlend-1.2.0 lib/youlend/path_sanitizer.rb
youlend-1.1.4 lib/youlend/path_sanitizer.rb
youlend-1.1.3 lib/youlend/path_sanitizer.rb
youlend-1.1.2 lib/youlend/path_sanitizer.rb
youlend-1.1.1 lib/youlend/path_sanitizer.rb
youlend-1.0.2 lib/youlend/path_sanitizer.rb
youlend-1.0.1 lib/youlend/path_sanitizer.rb
youlend-1.0.0 lib/youlend/path_sanitizer.rb