url: tiny optimization to #generate_url_from_drop

This commit is contained in:
Parker Moore 2016-01-04 18:18:28 -08:00
parent 9579924f8a
commit dc31264160
1 changed files with 3 additions and 3 deletions

View File

@ -78,14 +78,14 @@ module Jekyll
end end
def generate_url_from_drop(template) def generate_url_from_drop(template)
template.gsub(/:([a-z_]+)/) do |match| template.gsub(/:([a-z_]+)/.freeze) do |match|
replacement = @placeholders.public_send(match.sub(':', '')) replacement = @placeholders.public_send(match.sub(':'.freeze, ''.freeze))
if replacement.nil? if replacement.nil?
''.freeze ''.freeze
else else
self.class.escape_path(replacement) self.class.escape_path(replacement)
end end
end.gsub(/\/\//, '/') end.gsub(/\/\//.freeze, '/'.freeze)
end end
# Returns a sanitized String URL, stripping "../../" and multiples of "/", # Returns a sanitized String URL, stripping "../../" and multiples of "/",