Module: CLI::UI::Frame::FrameStyle

Included in:
Box, Bracket
Defined in:
lib/cli/ui/frame/frame_style.rb,
lib/cli/ui/frame/frame_style/box.rb,
lib/cli/ui/frame/frame_style/bracket.rb

Defined Under Namespace

Modules: Box, Bracket, Interface Classes: InvalidFrameStyleName

Constant Summary collapse

@@loaded_styles =

rubocop:disable Style/ClassVars

[]

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object


26
27
28
29
# File 'lib/cli/ui/frame/frame_style.rb', line 26

def extended(base)
  @@loaded_styles << base
  base.extend(Interface)
end

.loaded_stylesObject


11
12
13
# File 'lib/cli/ui/frame/frame_style.rb', line 11

def loaded_styles
  @@loaded_styles.map(&:name)
end

.lookup(name) ⇒ Object

Lookup a frame style via its name

Attributes

  • symbol - frame style name to lookup


20
21
22
23
24
# File 'lib/cli/ui/frame/frame_style.rb', line 20

def lookup(name)
  @@loaded_styles
    .find { |style| style.name.to_sym == name }
    .tap  { |style| raise InvalidFrameStyleName, name if style.nil? }
end