Method: LazyGraph::StackPointer#push

Defined in:
lib/lazy_graph/stack_pointer.rb

#push(frame, key) ⇒ Object

Pushes a new frame onto the stack, creating or reusing a StackPointer. Frames represent activation contexts; keys are identifiers within those frames.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lazy_graph/stack_pointer.rb', line 12

def push(frame, key)
  ptr = POINTER_POOL.pop || StackPointer.new
  ptr.parent = self
  ptr.root = root || self
  ptr.frame = frame
  ptr.key = key
  ptr.depth = depth + 1
  ptr.recursion_depth = recursion_depth
  ptr.pointer_cache&.clear
  ptr
end