Module: CLI::UI::Frame::FrameStack

Extended by:
T::Sig
Defined in:
lib/cli/ui/frame/frame_stack.rb

Defined Under Namespace

Classes: StackItem

Class Method Summary collapse

Methods included from T::Sig

sig

Class Method Details

.itemsObject



32
33
34
# File 'lib/cli/ui/frame/frame_stack.rb', line 32

def items
  Thread.current[:cliui_frame_stack] ||= []
end

.popObject



72
73
74
# File 'lib/cli/ui/frame/frame_stack.rb', line 72

def pop
  items.pop
end

.push(item = nil, color: nil, style: nil) ⇒ Object



62
63
64
65
66
67
68
# File 'lib/cli/ui/frame/frame_stack.rb', line 62

def push(item = nil, color: nil, style: nil)
  if color.nil? != style.nil? || item.nil? == color.nil?
    raise ArgumentError, 'Must give one of item or color: and style:'
  end

  items.push(item || StackItem.new(T.must(color), T.must(style)))
end