mirror of
https://github.com/kemko/liquid.git
synced 2026-01-02 08:15:41 +03:00
Compare commits
4 Commits
inline-com
...
liquid-pro
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b06b71c34 | ||
|
|
78cd06fb92 | ||
|
|
ca6237cb33 | ||
|
|
b9597b548c |
@@ -44,7 +44,7 @@ module Liquid
|
|||||||
include Enumerable
|
include Enumerable
|
||||||
|
|
||||||
class Timing
|
class Timing
|
||||||
attr_reader :code, :partial, :line_number, :children
|
attr_reader :code, :partial, :line_number, :children, :total_time, :self_time
|
||||||
|
|
||||||
def initialize(node, partial)
|
def initialize(node, partial)
|
||||||
@code = node.respond_to?(:raw) ? node.raw : node
|
@code = node.respond_to?(:raw) ? node.raw : node
|
||||||
@@ -63,6 +63,18 @@ module Liquid
|
|||||||
|
|
||||||
def finish
|
def finish
|
||||||
@end_time = Time.now
|
@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
|
end
|
||||||
|
|
||||||
def render_time
|
def render_time
|
||||||
|
|||||||
Reference in New Issue
Block a user