class Dev::UI::Glyph
Constants
Attributes
char[R]
codepoint[R]
color[R]
fmt[R]
handle[R]
to_s[R]
Public Class Methods
available()
click to toggle source
All available glyphs by name
# File lib/dev/ui/glyph.rb, line 69 def self.available MAP.keys end
lookup(name)
click to toggle source
Looks up a glyph by name
Raises¶ ↑
Raises a InvalidGlyphHandle
if the glyph is not available You likely need to create it with .new
or you made a typo
Returns¶ ↑
Returns a terminal output-capable string
# File lib/dev/ui/glyph.rb, line 61 def self.lookup(name) MAP.fetch(name.to_s) rescue KeyError raise InvalidGlyphHandle, name end
new(handle, codepoint, color)
click to toggle source
Creates a new glyph
Attributes¶ ↑
-
handle
- The handle in theMAP
constant -
codepoint
- The codepoint used to create the glyph (e.g.0x2717
for a ballotX
) -
color
- What color to output the glyph. CheckDev::UI::Color
for options.
# File lib/dev/ui/glyph.rb, line 28 def initialize(handle, codepoint, color) @handle = handle @codepoint = codepoint @color = color @char = [codepoint].pack('U') @to_s = color.code + char + Color::RESET.code @fmt = "{{#{color.name}:#{char}}}" MAP[handle] = self end