Class: Trailblazer::Activity::Trace::Stack
- Inherits:
-
Object
- Object
- Trailblazer::Activity::Trace::Stack
- Defined in:
- lib/trailblazer/activity/trace.rb
Overview
Mutable/stateful per design. We want a (global) stack!
Instance Method Summary collapse
- #<<(args) ⇒ Object
- #indent! ⇒ Object
-
#initialize ⇒ Stack
constructor
A new instance of Stack.
- #to_a ⇒ Object
- #unindent! ⇒ Object
Constructor Details
#initialize ⇒ Stack
Returns a new instance of Stack.
52 53 54 55 |
# File 'lib/trailblazer/activity/trace.rb', line 52 def initialize @nested = [] @stack = [ @nested ] end |
Instance Method Details
#<<(args) ⇒ Object
66 67 68 |
# File 'lib/trailblazer/activity/trace.rb', line 66 def <<(args) current << args end |
#indent! ⇒ Object
57 58 59 60 |
# File 'lib/trailblazer/activity/trace.rb', line 57 def indent! current << indented = [] @stack << indented end |
#to_a ⇒ Object
70 71 72 |
# File 'lib/trailblazer/activity/trace.rb', line 70 def to_a @nested end |
#unindent! ⇒ Object
62 63 64 |
# File 'lib/trailblazer/activity/trace.rb', line 62 def unindent! @stack.pop end |