class Trailblazer::Developer::Trace::Stack

Mutable/stateful per design. We want a (global) stack!

Attributes

top[R]

Public Class Methods

new() click to toggle source
# File lib/trailblazer/developer/trace.rb, line 134
def initialize
  @nested  = Level.new
  @stack   = [ @nested ]
end

Public Instance Methods

<<(entity) click to toggle source
# File lib/trailblazer/developer/trace.rb, line 148
def <<(entity)
  @top = entity

  current << entity
end
indent!() click to toggle source
# File lib/trailblazer/developer/trace.rb, line 139
def indent!
  current << indented = Level.new
  @stack << indented
end
to_a() click to toggle source
# File lib/trailblazer/developer/trace.rb, line 154
def to_a
  @nested
end
unindent!() click to toggle source
# File lib/trailblazer/developer/trace.rb, line 144
def unindent!
  @stack.pop
end

Private Instance Methods

current() click to toggle source
# File lib/trailblazer/developer/trace.rb, line 160
def current
  @stack.last
end