Use render! in benchmarks to avoid making it faster by breaking things.

This commit is contained in:
Dylan Thacker-Smith
2014-03-19 18:01:33 -04:00
parent b9feb415f6
commit 4b69f6ae83
2 changed files with 17 additions and 4 deletions
+14 -2
View File
@@ -45,11 +45,11 @@ module ShopFilter
end
def url_for_vendor(vendor_title)
"/collections/#{vendor_title.to_handle}"
"/collections/#{to_handle(vendor_title)}"
end
def url_for_type(type_title)
"/collections/#{type_title.to_handle}"
"/collections/#{to_handle(type_title)}"
end
def product_img_url(url, style = 'small')
@@ -95,4 +95,16 @@ module ShopFilter
input == 1 ? singular : plural
end
private
def to_handle(str)
result = str.dup
result.downcase!
result.delete!("'\"()[]")
result.gsub!(/\W+/, '-')
result.gsub!(/-+\z/, '') if result[-1] == '-'
result.gsub!(/\A-+/, '') if result[0] == '-'
result
end
end