Sha256: 6410edea0ad8bad077a4df40149d0d9ba7148ac5182396589e931a18df58c6b6

Contents?: true

Size: 1.21 KB

Versions: 6

Compression:

Stored size: 1.21 KB

Contents

# encoding: utf-8

module TTY
  class Prompt
    # Cross platform common Unicode symbols.
    #
    # @api public
    module Symbols
      KEYS = {
        tick: '✓',
        cross: '✘',
        star: '★',
        dot: '•',
        pointer: '‣',
        line: '─',
        pipe: '|',
        handle: 'O',
        ellipsis: '…',
        radio_on: '⬢',
        radio_off: '⬡',
        checkbox_on: '☒',
        checkbox_off: '☐',
        circle_on: 'ⓧ',
        circle_off: 'Ⓘ'
      }.freeze

      WIN_KEYS = {
        tick: '√',
        cross: '×',
        star: '*',
        dot: '.',
        pointer: '>',
        line: '-',
        pipe: '|',
        handle: 'O',
        ellipsis: '...',
        radio_on: '(*)',
        radio_off: '( )',
        checkbox_on: '[×]',
        checkbox_off: '[ ]',
        circle_on: '(x)',
        circle_off: '( )'
      }.freeze

      def symbols
        @symbols ||= windows? ? WIN_KEYS : KEYS
      end
      module_function :symbols

      # Check if Windowz
      #
      # @return [Boolean]
      #
      # @api public
      def windows?
        ::File::ALT_SEPARATOR == "\\"
      end
      module_function :windows?
    end # Symbols
  end # Prompt
end # TTY

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
tty-prompt-0.13.2 lib/tty/prompt/symbols.rb
tty-prompt-0.13.1 lib/tty/prompt/symbols.rb
tty-prompt-0.13.0 lib/tty/prompt/symbols.rb
austb-tty-prompt-0.13.0 lib/tty/prompt/symbols.rb
tty-prompt-0.12.0 lib/tty/prompt/symbols.rb
tty-prompt-0.11.0 lib/tty/prompt/symbols.rb