Class: Trailblazer::Developer::Trace::Stack

Inherits:
Object
  • Object
show all
Defined in:
lib/trailblazer/developer/trace.rb

Overview

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

Instance Method Summary collapse

Constructor Details

#initializeStack



118
119
120
121
# File 'lib/trailblazer/developer/trace.rb', line 118

def initialize
  @nested  = Level.new
  @stack   = [ @nested ]
end

Instance Method Details

#<<(args) ⇒ Object



132
133
134
# File 'lib/trailblazer/developer/trace.rb', line 132

def <<(args)
  current << args
end

#indent!Object



123
124
125
126
# File 'lib/trailblazer/developer/trace.rb', line 123

def indent!
  current << indented = Level.new
  @stack << indented
end

#to_aObject



136
137
138
# File 'lib/trailblazer/developer/trace.rb', line 136

def to_a
  @nested
end

#unindent!Object



128
129
130
# File 'lib/trailblazer/developer/trace.rb', line 128

def unindent!
  @stack.pop
end