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.
-
#template_name ⇒ Object
(also: #partial)
readonly
Returns the value of attribute template_name.
-
#total_time ⇒ Object
(also: #render_time)
Returns the value of attribute total_time.
Instance Method Summary collapse
-
#initialize(code: nil, template_name: nil, line_number: nil) ⇒ Timing
constructor
A new instance of Timing.
- #self_time ⇒ Object
Constructor Details
#initialize(code: nil, template_name: nil, line_number: nil) ⇒ Timing
Returns a new instance of Timing.
54 55 56 57 58 59 |
# File 'lib/liquid/profiler.rb', line 54 def initialize(code: nil, template_name: nil, line_number: nil) @code = code @template_name = template_name @line_number = line_number @children = [] end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
49 50 51 |
# File 'lib/liquid/profiler.rb', line 49 def children @children end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
49 50 51 |
# File 'lib/liquid/profiler.rb', line 49 def code @code end |
#line_number ⇒ Object (readonly)
Returns the value of attribute line_number.
49 50 51 |
# File 'lib/liquid/profiler.rb', line 49 def line_number @line_number end |
#template_name ⇒ Object (readonly) Also known as: partial
Returns the value of attribute template_name.
49 50 51 |
# File 'lib/liquid/profiler.rb', line 49 def template_name @template_name end |
#total_time ⇒ Object Also known as: render_time
Returns the value of attribute total_time.
50 51 52 |
# File 'lib/liquid/profiler.rb', line 50 def total_time @total_time end |
Instance Method Details
#self_time ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/liquid/profiler.rb', line 61 def self_time @self_time ||= begin total_children_time = 0.0 @children.each do |child| total_children_time += child.total_time end @total_time - total_children_time end end |