def path_concat(other)
if other.host? or other.scheme?
raise ArgumentError, "Expected to receive a relative template but got an absoulte one: #{other.inspect}. If you think this is a bug, please report it."
end
return self if other.tokens.none?
return other if self.tokens.none?
tail = self.tokens.last
head = other.tokens.first
if tail.ends_with_slash?
if head.starts_with_slash?
return self.class.new( remove_double_slash(self.tokens, other.tokens).join )
end
elsif !head.starts_with_slash?
return self.class.new( (self.tokens + ['/'] + other.tokens).join)
end
return self.class.new( (self.tokens + other.tokens).join )
end