Module: Clack::Symbols
- Defined in:
- lib/clack/symbols.rb
Overview
Unicode and ASCII symbols used for prompt rendering. Automatically selects Unicode or ASCII fallback based on terminal capabilities.
Constant Summary collapse
- S_STEP_ACTIVE =
Step indicators
unicode? ? "◆" : "*"
- S_STEP_CANCEL =
Unicode cancel step indicator, or ASCII fallback.
unicode? ? "■" : "x"
- S_STEP_ERROR =
Unicode error step indicator, or ASCII fallback.
unicode? ? "▲" : "!"
- S_STEP_SUBMIT =
Unicode submit step indicator, or ASCII fallback.
unicode? ? "◇" : "o"
- S_RADIO_ACTIVE =
Radio buttons
unicode? ? "●" : ">"
- S_RADIO_INACTIVE =
Unicode inactive radio button, or ASCII fallback.
unicode? ? "○" : " "
- S_CHECKBOX_ACTIVE =
Checkboxes
unicode? ? "◻" : "[•]"
- S_CHECKBOX_SELECTED =
Unicode selected checkbox, or ASCII fallback.
unicode? ? "◼" : "[+]"
- S_CHECKBOX_INACTIVE =
Unicode inactive checkbox, or ASCII fallback.
unicode? ? "◻" : "[ ]"
- S_PASSWORD_MASK =
Password mask
unicode? ? "▪" : "*"
- S_BAR =
Bars and connectors
unicode? ? "│" : "|"
- S_BAR_START =
Unicode bar start connector, or ASCII fallback.
unicode? ? "┌" : "+"
- S_BAR_END =
Unicode bar end connector, or ASCII fallback.
unicode? ? "└" : "+"
- S_BAR_H =
Unicode horizontal bar, or ASCII fallback.
unicode? ? "─" : "-"
- S_CORNER_TOP_RIGHT =
Unicode top-right corner, or ASCII fallback.
unicode? ? "╮" : "+"
- S_CORNER_TOP_LEFT =
Unicode top-left corner, or ASCII fallback.
unicode? ? "╭" : "+"
- S_CORNER_BOTTOM_RIGHT =
Unicode bottom-right corner, or ASCII fallback.
unicode? ? "╯" : "+"
- S_CORNER_BOTTOM_LEFT =
Unicode bottom-left corner, or ASCII fallback.
unicode? ? "╰" : "+"
- S_CONNECT_LEFT =
Unicode left T-connector, or ASCII fallback.
unicode? ? "├" : "+"
- S_BAR_START_RIGHT =
Square corners (for box with rounded: false)
unicode? ? "┐" : "+"
- S_BAR_END_RIGHT =
Unicode square bottom-right corner, or ASCII fallback.
unicode? ? "┘" : "+"
- S_INFO =
Log symbols
unicode? ? "●" : "*"
- S_SUCCESS =
Unicode success log symbol, or ASCII fallback.
unicode? ? "◆" : "*"
- S_WARN =
Unicode warning log symbol, or ASCII fallback.
unicode? ? "▲" : "!"
- S_ERROR =
Unicode error log symbol, or ASCII fallback.
unicode? ? "■" : "x"
- S_FOLDER =
File system
unicode? ? "📁" : "[D]"
- S_FILE =
Unicode file icon, or ASCII fallback.
unicode? ? "📄" : "[F]"
- SPINNER_FRAMES =
Spinner frames - quarter circle rotation pattern
unicode? ? %w[◒ ◐ ◓ ◑] : %w[• o O 0]
- SPINNER_DELAY =
Delay between spinner frame updates (seconds).
unicode? ? 0.08 : 0.12
- S_PROGRESS_FILLED =
Progress bar characters
unicode? ? "█" : "#"
- S_PROGRESS_EMPTY =
Unicode empty progress segment, or ASCII fallback.
unicode? ? "░" : "-"
- S_PROGRESS_BLOCKS =
Alternative progress bar (smoother gradient)
unicode? ? %w[░ ▒ ▓ █] : %w[- = # #]
Class Method Summary collapse
-
.reset! ⇒ void
Reset cached unicode detection (useful for testing).
-
.unicode? ⇒ Boolean
Check if unicode output is enabled.
Class Method Details
.reset! ⇒ void
This method returns an undefined value.
Reset cached unicode detection (useful for testing).
19 20 21 |
# File 'lib/clack/symbols.rb', line 19 def reset! remove_instance_variable(:@unicode) if defined?(@unicode) end |
.unicode? ⇒ Boolean
Check if unicode output is enabled. CLACK_UNICODE=1 forces unicode, CLACK_UNICODE=0 forces ASCII. Otherwise auto-detects from TTY and TERM.
11 12 13 14 15 |
# File 'lib/clack/symbols.rb', line 11 def unicode? return @unicode if defined?(@unicode) @unicode = compute_unicode_support end |