mirror of
https://github.com/kemko/liquid.git
synced 2026-01-01 15:55:40 +03:00
Compare commits
7 Commits
format_fil
...
liquid-pro
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b06b71c34 | ||
|
|
78cd06fb92 | ||
|
|
ca6237cb33 | ||
|
|
b9597b548c | ||
|
|
806b2622da | ||
|
|
c34f7c9b2c | ||
|
|
604d899496 |
2
Gemfile
2
Gemfile
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user