Module: BucketStore::UriBuilder

Defined in:
lib/bucket_store/uri_builder.rb

Class Method Summary collapse

Class Method Details

.sanitize(input, replacement = "__") ⇒ String

Sanitizes the input as not all characters are valid as either URIs or as bucket keys. When we get them we want to replace them with something we can process.

Parameters:

  • input (String)

    the string to sanitise

  • replacement (String) (defaults to: "__")

    the replacement string for invalid characters

Returns:

  • (String)

    the sanitised string



11
12
13
# File 'lib/bucket_store/uri_builder.rb', line 11

def self.sanitize(input, replacement = "__")
  input.gsub(/[{}<>%]/, replacement)
end