Class: Liquid::Profiler::Timing
- Inherits:
-
Object
- Object
- Liquid::Profiler::Timing
- Defined in:
- lib/liquid/profiler.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#line_number ⇒ Object
readonly
Returns the value of attribute line_number.
-
#partial ⇒ Object
readonly
Returns the value of attribute partial.
Class Method Summary collapse
Instance Method Summary collapse
- #finish ⇒ Object
-
#initialize(node, partial) ⇒ Timing
constructor
A new instance of Timing.
- #render_time ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(node, partial) ⇒ Timing
Returns a new instance of Timing.
49 50 51 52 53 54 |
# File 'lib/liquid/profiler.rb', line 49 def initialize(node, partial) @code = node.respond_to?(:raw) ? node.raw : node @partial = partial @line_number = node.respond_to?(:line_number) ? node.line_number : nil @children = [] end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
47 48 49 |
# File 'lib/liquid/profiler.rb', line 47 def children @children end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
47 48 49 |
# File 'lib/liquid/profiler.rb', line 47 def code @code end |
#line_number ⇒ Object (readonly)
Returns the value of attribute line_number.
47 48 49 |
# File 'lib/liquid/profiler.rb', line 47 def line_number @line_number end |
#partial ⇒ Object (readonly)
Returns the value of attribute partial.
47 48 49 |
# File 'lib/liquid/profiler.rb', line 47 def partial @partial end |
Class Method Details
.start(node, partial) ⇒ Object
56 57 58 |
# File 'lib/liquid/profiler.rb', line 56 def self.start(node, partial) new(node, partial).tap(&:start) end |
Instance Method Details
#finish ⇒ Object
64 65 66 |
# File 'lib/liquid/profiler.rb', line 64 def finish @end_time = Time.now end |
#render_time ⇒ Object
68 69 70 |
# File 'lib/liquid/profiler.rb', line 68 def render_time @end_time - @start_time end |
#start ⇒ Object
60 61 62 |
# File 'lib/liquid/profiler.rb', line 60 def start @start_time = Time.now end |