Sha256: 146c43f01a2e905a386b8a756d90bc266a6d8e023f45ccc32ee5bec4c1c04c87

Contents?: true

Size: 787 Bytes

Versions: 4

Compression:

Stored size: 787 Bytes

Contents

require 'optparse'

module Inch
  module CLI
    module Command
      module Output
        # Abstract base class for CLI output
        #
        class Base
          include TraceHelper

          PRIORITY_MAP = {
              (4..99) => "\u2191", # north
              (2...4) => "\u2197", # north-east
              (0..1)  => "\u2192", # east
              (-2..-1) => "\u2198", # south-east
              (-99..-3) => "\u2193", # south-east
            }
          PRIORITY_ARROWS = PRIORITY_MAP.values

          def priority_arrow(priority, color = :white)
            PRIORITY_MAP.each do |range, str|
              if range.include?(priority)
                return str.color(color).dark
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
inch-0.1.3 lib/inch/cli/command/output/base.rb
inch-0.1.2 lib/inch/cli/command/output/base.rb
inch-0.1.1 lib/inch/cli/command/output/base.rb
inch-0.1.0 lib/inch/cli/command/output/base.rb