Class: Rack::Insight::TemplatesPanel::Stats
- Inherits:
-
Object
- Object
- Rack::Insight::TemplatesPanel::Stats
- Includes:
- Logging
- Defined in:
- lib/rack/insight/panels/templates_panel/stats.rb
Instance Attribute Summary collapse
-
#current ⇒ Object
readonly
Returns the value of attribute current.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
-
#begin_record!(rendering) ⇒ Object
Track when each template starts being rendered.
- #finish! ⇒ Object
-
#finish_record!(timing) ⇒ Object
Track when each template finishes being rendered, move current back up the rendering chain.
-
#initialize(*args) ⇒ Stats
constructor
A new instance of Stats.
- #to_s ⇒ Object
Methods included from Logging
Constructor Details
Instance Attribute Details
#current ⇒ Object (readonly)
Returns the value of attribute current.
8 9 10 |
# File 'lib/rack/insight/panels/templates_panel/stats.rb', line 8 def current @current end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
8 9 10 |
# File 'lib/rack/insight/panels/templates_panel/stats.rb', line 8 def root @root end |
Instance Method Details
#begin_record!(rendering) ⇒ Object
Track when each template starts being rendered
16 17 18 19 |
# File 'lib/rack/insight/panels/templates_panel/stats.rb', line 16 def begin_record!(rendering) @current.add!(rendering) # Add the rendering as a child of the current and make rendering the new current @current = rendering end |
#finish! ⇒ Object
29 30 31 32 |
# File 'lib/rack/insight/panels/templates_panel/stats.rb', line 29 def finish! @root.finish!(root._calculate_child_time) @current = nil end |
#finish_record!(timing) ⇒ Object
Track when each template finishes being rendered, move current back up the rendering chain
22 23 24 25 26 27 |
# File 'lib/rack/insight/panels/templates_panel/stats.rb', line 22 def finish_record!(timing) # This is the one being completed now, and for which we now know the timing duration @current.finish!(timing) # Prepare for the next template to finish @current = @current.parent end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/rack/insight/panels/templates_panel/stats.rb', line 34 def to_s "#{self.root.to_s}" end |