Class: TraceViz::Context::Tracking::Depth
- Inherits:
-
Object
- Object
- TraceViz::Context::Tracking::Depth
- Defined in:
- lib/trace_viz/context/tracking/depth.rb
Instance Attribute Summary collapse
-
#current ⇒ Object
readonly
Returns the value of attribute current.
Instance Method Summary collapse
- #decrement ⇒ Object
- #increment ⇒ Object
-
#initialize(current = 0) ⇒ Depth
constructor
A new instance of Depth.
- #reset ⇒ Object
- #zero? ⇒ Boolean
Constructor Details
#initialize(current = 0) ⇒ Depth
Returns a new instance of Depth.
9 10 11 |
# File 'lib/trace_viz/context/tracking/depth.rb', line 9 def initialize(current = 0) @current = current end |
Instance Attribute Details
#current ⇒ Object (readonly)
Returns the value of attribute current.
7 8 9 |
# File 'lib/trace_viz/context/tracking/depth.rb', line 7 def current @current end |
Instance Method Details
#decrement ⇒ Object
17 18 19 |
# File 'lib/trace_viz/context/tracking/depth.rb', line 17 def decrement @current -= 1 if @current.positive? end |
#increment ⇒ Object
13 14 15 |
# File 'lib/trace_viz/context/tracking/depth.rb', line 13 def increment @current += 1 end |
#reset ⇒ Object
21 22 23 |
# File 'lib/trace_viz/context/tracking/depth.rb', line 21 def reset @current = 0 end |
#zero? ⇒ Boolean
25 26 27 |
# File 'lib/trace_viz/context/tracking/depth.rb', line 25 def zero? @current.zero? end |