Compare commits

...

7 Commits

Author SHA1 Message Date
Umair Choudhary
9b06b71c34 added self time to profiler 2019-09-11 11:56:36 -04:00
Umair Choudhary
78cd06fb92 profiler 2019-09-10 15:38:54 -04:00
Umair Choudhary
ca6237cb33 render time attribute 2019-09-10 15:32:31 -04:00
Umair Choudhary
b9597b548c Add render time attr to profiler 2019-09-10 15:11:21 -04:00
Justin Li
806b2622da Switch back to Liquid-C master, since https://github.com/Shopify/liquid-c/pull/50 is merged 2019-09-04 15:12:51 -04:00
Mike Angell
c34f7c9b2c Merge pull request #1145 from Shopify/master-fixes
Render tag styling fixes
2019-09-04 14:25:38 +10:00
Mike Angell
604d899496 Render tag styling fixes 2019-08-31 22:48:25 +10:00
5 changed files with 20 additions and 8 deletions

View File

@@ -20,6 +20,6 @@ group :test do
gem 'rubocop-performance', require: false
platform :mri, :truffleruby do
gem 'liquid-c', github: 'Shopify/liquid-c', ref: 'liquid-tag'
gem 'liquid-c', github: 'Shopify/liquid-c', ref: 'master'
end
end

View File

@@ -44,7 +44,7 @@ module Liquid
include Enumerable
class Timing
attr_reader :code, :partial, :line_number, :children
attr_reader :code, :partial, :line_number, :children, :total_time, :self_time
def initialize(node, partial)
@code = node.respond_to?(:raw) ? node.raw : node
@@ -63,6 +63,18 @@ module Liquid
def finish
@end_time = Time.now
@total_time = @end_time - @start_time
if @children.size == 0
@self_time = @total_time
else
total_children_time = 0
@children.each do |child|
total_children_time += child.total_time
end
@self_time = @total_time - total_children_time
end
end
def render_time

View File

@@ -1,13 +1,13 @@
module Liquid
class Render < Tag
Syntax = /(#{QuotedString})#{QuotedFragment}*/o
SYNTAX = /(#{QuotedString})#{QuotedFragment}*/o
attr_reader :template_name_expr, :attributes
def initialize(tag_name, markup, options)
super
raise SyntaxError.new(options[:locale].t("errors.syntax.render".freeze)) unless markup =~ Syntax
raise SyntaxError.new(options[:locale].t("errors.syntax.render".freeze)) unless markup =~ SYNTAX
template_name = $1

View File

@@ -110,7 +110,7 @@ class RenderTagTest < Minitest::Test
file_system = StubFileSystem.new('snippet' => 'echo')
assert_equal 'echoecho',
Template.parse('{% render "snippet" %}{% render "snippet" %}')
.render!({}, registers: { file_system: file_system })
.render!({}, registers: { file_system: file_system })
assert_equal 1, file_system.file_read_count
end

View File

@@ -4,7 +4,7 @@ class PartialCacheUnitTest < Minitest::Test
def test_uses_the_file_system_register_if_present
context = Liquid::Context.build(
registers: {
file_system: StubFileSystem.new('my_partial' => 'my partial body')
file_system: StubFileSystem.new('my_partial' => 'my partial body'),
}
)
@@ -41,12 +41,12 @@ class PartialCacheUnitTest < Minitest::Test
)
context_one = Liquid::Context.build(
registers: {
file_system: shared_file_system
file_system: shared_file_system,
}
)
context_two = Liquid::Context.build(
registers: {
file_system: shared_file_system
file_system: shared_file_system,
}
)