Sha256: 639ece2156d12ecdcbb8b359e81672ef480694c399f0a6ffe56697bbf49e18b5

Contents?: true

Size: 1.34 KB

Versions: 5

Compression:

Stored size: 1.34 KB

Contents

# encoding: utf-8
# frozen_string_literal: true

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

      WIN_KEYS = {
        tick: '√',
        cross: 'x',
        star: '*',
        square: '[█]',
        square_empty: '[ ]',
        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

5 entries across 5 versions & 1 rubygems

Version Path
tty-prompt-0.17.2 lib/tty/prompt/symbols.rb
tty-prompt-0.17.1 lib/tty/prompt/symbols.rb
tty-prompt-0.17.0 lib/tty/prompt/symbols.rb
tty-prompt-0.16.1 lib/tty/prompt/symbols.rb
tty-prompt-0.16.0 lib/tty/prompt/symbols.rb