Class: Gamera::PathJoiner

Inherits:
Object
  • Object
show all
Defined in:
lib/gamera/utils/path_joiner.rb

Class Method Summary collapse

Class Method Details

.path_join(*elements) ⇒ String

This is a utility method to clean up URLs formed by concatenation since we sometimes ended up with “//” in the middle of URLs which broke the url_matcher checks.

Parameters:

  • elements (String)

    duck types

Returns:

  • (String)

    of elements joined by single “/” characters.



9
10
11
# File 'lib/gamera/utils/path_joiner.rb', line 9

def self.path_join(*elements)
  "/#{elements.join('/')}".gsub(%r{//+}, '/')
end