Class: Timify::Span
- Inherits:
-
Object
- Object
- Timify::Span
- Defined in:
- lib/timify/span.rb
Overview
One timed block or mark in the tree returned by #totals.
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#exclusive ⇒ Object
Returns the value of attribute exclusive.
-
#inclusive ⇒ Object
Returns the value of attribute inclusive.
-
#label ⇒ Object
Returns the value of attribute label.
-
#location ⇒ Object
Returns the value of attribute location.
-
#started_mark ⇒ Object
Returns the value of attribute started_mark.
Instance Method Summary collapse
-
#initialize(label:, location:, started_mark: nil) ⇒ Span
constructor
A new instance of Span.
- #to_h ⇒ Hash
Constructor Details
#initialize(label:, location:, started_mark: nil) ⇒ Span
Returns a new instance of Span.
8 9 10 11 12 13 14 15 |
# File 'lib/timify/span.rb', line 8 def initialize(label:, location:, started_mark: nil) @label = label @location = location @started_mark = started_mark @inclusive = 0.0 @exclusive = 0.0 @children = [] end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
6 7 8 |
# File 'lib/timify/span.rb', line 6 def children @children end |
#exclusive ⇒ Object
Returns the value of attribute exclusive.
6 7 8 |
# File 'lib/timify/span.rb', line 6 def exclusive @exclusive end |
#inclusive ⇒ Object
Returns the value of attribute inclusive.
6 7 8 |
# File 'lib/timify/span.rb', line 6 def inclusive @inclusive end |
#label ⇒ Object
Returns the value of attribute label.
6 7 8 |
# File 'lib/timify/span.rb', line 6 def label @label end |
#location ⇒ Object
Returns the value of attribute location.
6 7 8 |
# File 'lib/timify/span.rb', line 6 def location @location end |
#started_mark ⇒ Object
Returns the value of attribute started_mark.
6 7 8 |
# File 'lib/timify/span.rb', line 6 def started_mark @started_mark end |
Instance Method Details
#to_h ⇒ Hash
18 19 20 21 22 23 24 25 26 |
# File 'lib/timify/span.rb', line 18 def to_h { label: label, location: location, secs: exclusive, inclusive: inclusive, children: children.map(&:to_h) } end |