Class: TraceViz::Context::Tracking::Depth

Inherits:
Object
  • Object
show all
Defined in:
lib/trace_viz/context/tracking/depth.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#currentObject (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

#decrementObject



17
18
19
# File 'lib/trace_viz/context/tracking/depth.rb', line 17

def decrement
  @current -= 1 if @current.positive?
end

#incrementObject



13
14
15
# File 'lib/trace_viz/context/tracking/depth.rb', line 13

def increment
  @current += 1
end

#resetObject



21
22
23
# File 'lib/trace_viz/context/tracking/depth.rb', line 21

def reset
  @current = 0
end

#zero?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/trace_viz/context/tracking/depth.rb', line 25

def zero?
  @current.zero?
end