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



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

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

.popObject



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

def pop
  items.pop
end

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



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

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