Sha256: 22378a44330612228c0fcf66e56fa8a7f7034e230c6ef1ab2c2744943926f00c

Contents?: true

Size: 1.93 KB

Versions: 7

Compression:

Stored size: 1.93 KB

Contents

# 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: "•",
        bullet: "●",
        bullet_empty: "○",
        marker: "‣",
        line: "─",
        pipe: "|",
        ellipsis: "…",
        radio_on: "⬢",
        radio_off: "⬡",
        checkbox_on: "☒",
        checkbox_off: "☐",
        circle: "◯",
        circle_on: "ⓧ",
        circle_off: "Ⓘ",
        arrow_up: "↑",
        arrow_down: "↓",
        arrow_up_down: "↕",
        arrow_left: "←",
        arrow_right: "→",
        arrow_left_right: "↔",
        heart: "♥",
        diamond: "♦",
        club: "♣",
        spade: "♠"
      }.freeze

      WIN_KEYS = {
        tick: "√",
        cross: "x",
        star: "*",
        square: "[█]",
        square_empty: "[ ]",
        dot: ".",
        bullet: "O",
        bullet_empty: "○",
        marker: ">",
        line: "-",
        pipe: "|",
        ellipsis: "...",
        radio_on: "(*)",
        radio_off: "( )",
        checkbox_on: "[×]",
        checkbox_off: "[ ]",
        circle: "( )",
        circle_on: "(x)",
        circle_off: "( )",
        arrow_up: "↑",
        arrow_down: "↓",
        arrow_up_down: "↕",
        arrow_left: "←",
        arrow_right: "→",
        arrow_left_right: "↔",
        heart: "♥",
        diamond: "♦",
        club: "♣",
        spade: "♠"
      }.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

7 entries across 7 versions & 2 rubygems

Version Path
tty-prompt-0.23.1 lib/tty/prompt/symbols.rb
tty-prompt-0.23.0 lib/tty/prompt/symbols.rb
lotrd-0.1.9 vendor/cache/ruby/2.6.0/gems/tty-prompt-0.22.0/lib/tty/prompt/symbols.rb
lotrd-0.1.8 vendor/cache/ruby/2.6.0/gems/tty-prompt-0.22.0/lib/tty/prompt/symbols.rb
lotrd-0.1.6 vendor/cache/ruby/2.6.0/gems/tty-prompt-0.22.0/lib/tty/prompt/symbols.rb
lotrd-0.1.5 vendor/cache/ruby/2.6.0/gems/tty-prompt-0.22.0/lib/tty/prompt/symbols.rb
tty-prompt-0.22.0 lib/tty/prompt/symbols.rb