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
-
.clear ⇒ Object
private
Clear the context stack.
-
.current ⇒ Object
private
Return the current context.
-
.pop ⇒ Object
private
Pop the top context.
-
.push(children) ⇒ Object
private
Push a new context.
Class Method Details
.clear ⇒ 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.
Clear the context stack.
57 58 59 |
# File 'lib/plushie/ui.rb', line 57 def self.clear Thread.current[:_plushie_ctx_stack] = nil end |
.current ⇒ 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.
Return the current context.
42 |
# File 'lib/plushie/ui.rb', line 42 def self.current = (Thread.current[:_plushie_ctx_stack] || []).last |
.pop ⇒ 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.
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) |