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

This commit is contained in:
Dylan Thacker-Smith
2014-03-19 17:55:29 -04:00
parent b9feb415f6
commit 4b69f6ae83
2 changed files with 17 additions and 4 deletions

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

View File

@@ -8,6 +8,7 @@
require 'rubygems'
require 'active_support'
require 'active_support/json'
require 'yaml'
require 'digest/md5'
require File.dirname(__FILE__) + '/shopify/liquid'
@@ -70,11 +71,11 @@ class ThemeRunner
tmpl.assigns['template'] = page_template
tmpl.registers[:file_system] = ThemeRunner::FileSystem.new(File.dirname(template_file))
content_for_layout = tmpl.parse(template).render(assigns)
content_for_layout = tmpl.parse(template).render!(assigns)
if layout
assigns['content_for_layout'] = content_for_layout
tmpl.parse(layout).render(assigns)
tmpl.parse(layout).render!(assigns)
else
content_for_layout
end