Class: Paco::Callstack
- Inherits:
-
Object
- Object
- Paco::Callstack
- Defined in:
- lib/paco/callstack.rb
Instance Attribute Summary collapse
-
#stack ⇒ Object
readonly
Returns the value of attribute stack.
Instance Method Summary collapse
- #failure(**params) ⇒ Object
-
#initialize ⇒ Callstack
constructor
A new instance of Callstack.
- #start(**params) ⇒ Object
- #success(**params) ⇒ Object
Constructor Details
#initialize ⇒ Callstack
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
#stack ⇒ Object (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 |