Class: Paco::Callstack

Inherits:
Object
  • Object
show all
Defined in:
lib/paco/callstack.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCallstack

Returns a new instance of Callstack.



7
8
9
10
# File 'lib/paco/callstack.rb', line 7

def initialize
  @stack = []
  @depth = 0
end

Instance Attribute Details

#stackObject (readonly)

Returns the value of attribute stack.



5
6
7
# File 'lib/paco/callstack.rb', line 5

def stack
  @stack
end

Instance Method Details

#failure(**params) ⇒ Object



12
13
14
15
# File 'lib/paco/callstack.rb', line 12

def failure(**params)
  @depth -= 1
  @stack << params.merge(status: :failure, depth: @depth)
end

#start(**params) ⇒ Object



17
18
19
20
# File 'lib/paco/callstack.rb', line 17

def start(**params)
  @depth += 1
  @stack << params.merge(status: :start, depth: @depth)
end

#success(**params) ⇒ Object



22
23
24
25
# File 'lib/paco/callstack.rb', line 22

def success(**params)
  @depth -= 1
  @stack << params.merge(status: :success, depth: @depth)
end