Module: Plushie::UI::Context Private

Defined in:
lib/plushie/ui.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Thread-local context for nesting DSL calls.

Class Method Summary collapse

Class Method Details

.clearObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Clear the context stack.



57
58
59
# File 'lib/plushie/ui.rb', line 57

def self.clear
  Thread.current[:_plushie_ctx_stack] = nil
end

.currentObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return the current context.



42
# File 'lib/plushie/ui.rb', line 42

def self.current = (Thread.current[:_plushie_ctx_stack] || []).last

.popObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Pop the top context.



50
51
52
53
# File 'lib/plushie/ui.rb', line 50

def self.pop
  stack = Thread.current[:_plushie_ctx_stack]
  stack&.pop
end

.push(children) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Push a new context.



46
# File 'lib/plushie/ui.rb', line 46

def self.push(children) = (Thread.current[:_plushie_ctx_stack] ||= []).push(children)