Class: Teek::UI::TreeInspector
- Inherits:
-
Object
- Object
- Teek::UI::TreeInspector
- Defined in:
- lib/teek/ui/tree_inspector.rb
Overview
Build-phase debug tooling: a readable ASCII tree of a Document's current shape, and (opt-in) a step-by-step trace of how it got there. Deliberately its own class, not methods on Document/Node - those stay focused on constructing/indexing/parent-tracking the retained tree; this is purely an outside observer of it, built the same way an app author's own tooling would be (see Document#subscribe).
Defined Under Namespace
Classes: Event
Instance Attribute Summary collapse
-
#log ⇒ Array<Event>
readonly
Every push/pop/append recorded so far, in order - always empty unless constructed with
trace: true.
Instance Method Summary collapse
-
#initialize(document, trace: false) ⇒ TreeInspector
constructor
A new instance of TreeInspector.
-
#print_tree ⇒ void
#to_s, straight to stdout.
- #to_s ⇒ String
Constructor Details
#initialize(document, trace: false) ⇒ TreeInspector
Returns a new instance of TreeInspector.
40 41 42 43 44 |
# File 'lib/teek/ui/tree_inspector.rb', line 40 def initialize(document, trace: false) @document = document @log = [] subscribe! if trace end |
Instance Attribute Details
#log ⇒ Array<Event> (readonly)
Returns every push/pop/append recorded so far, in
order - always empty unless constructed with trace: true.
73 74 75 |
# File 'lib/teek/ui/tree_inspector.rb', line 73 def log @log end |
Instance Method Details
#print_tree ⇒ void
This method returns an undefined value.
#to_s, straight to stdout.
67 68 69 |
# File 'lib/teek/ui/tree_inspector.rb', line 67 def print_tree puts to_s end |