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(token, partial) ⇒ Timing
constructor
A new instance of Timing.
- #render_time ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(token, partial) ⇒ Timing
Returns a new instance of Timing.
47 48 49 50 51 52 |
# File 'lib/liquid/profiler.rb', line 47 def initialize(token, partial) @code = token.respond_to?(:raw) ? token.raw : token @partial = partial @line_number = token.respond_to?(:line_number) ? token.line_number : nil @children = [] end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
45 46 47 |
# File 'lib/liquid/profiler.rb', line 45 def children @children end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
45 46 47 |
# File 'lib/liquid/profiler.rb', line 45 def code @code end |
#line_number ⇒ Object (readonly)
Returns the value of attribute line_number.
45 46 47 |
# File 'lib/liquid/profiler.rb', line 45 def line_number @line_number end |
#partial ⇒ Object (readonly)
Returns the value of attribute partial.
45 46 47 |
# File 'lib/liquid/profiler.rb', line 45 def partial @partial end |
Class Method Details
.start(token, partial) ⇒ Object
54 55 56 57 58 |
# File 'lib/liquid/profiler.rb', line 54 def self.start(token, partial) new(token, partial).tap do |t| t.start end 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 |