Class: Trailblazer::Developer::Trace::Stack
- Inherits:
-
Object
- Object
- Trailblazer::Developer::Trace::Stack
- Defined in:
- lib/trailblazer/developer/trace.rb
Overview
Mutable/stateful per design. We want a (global) stack!
Instance Attribute Summary collapse
-
#top ⇒ Object
readonly
Returns the value of attribute top.
Instance Method Summary collapse
- #<<(entity) ⇒ Object
- #indent! ⇒ Object
-
#initialize ⇒ Stack
constructor
A new instance of Stack.
- #to_a ⇒ Object
- #unindent! ⇒ Object
Constructor Details
Instance Attribute Details
#top ⇒ Object (readonly)
Returns the value of attribute top.
132 133 134 |
# File 'lib/trailblazer/developer/trace.rb', line 132 def top @top end |
Instance Method Details
#<<(entity) ⇒ Object
148 149 150 151 152 |
# File 'lib/trailblazer/developer/trace.rb', line 148 def <<(entity) @top = entity current << entity end |
#indent! ⇒ Object
139 140 141 142 |
# File 'lib/trailblazer/developer/trace.rb', line 139 def indent! current << indented = Level.new @stack << indented end |
#to_a ⇒ Object
154 155 156 |
# File 'lib/trailblazer/developer/trace.rb', line 154 def to_a @nested end |
#unindent! ⇒ Object
144 145 146 |
# File 'lib/trailblazer/developer/trace.rb', line 144 def unindent! @stack.pop end |