Sha256: 092523567099e574b130c1f76a2082d9d9e3d6e354093d4708293198d61f4411

Contents?: true

Size: 1.31 KB

Versions: 2

Compression:

Stored size: 1.31 KB

Contents

# encoding: utf-8

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: '×',
        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

2 entries across 2 versions & 1 rubygems

Version Path
tty-prompt-0.15.0 lib/tty/prompt/symbols.rb
tty-prompt-0.14.0 lib/tty/prompt/symbols.rb