Sha256: 8e5bf860cc8b97c3be93ff35a668cba3540dc1a65c565d953a0d9284db16c8c0

Contents?: true

Size: 700 Bytes

Versions: 3

Compression:

Stored size: 700 Bytes

Contents

module Minitest
  module Reporters
    module ANSI
      module Code

        def self.color?
          return false if ENV['MINITEST_REPORTERS_MONO']
          color_terminal = ENV['TERM'].to_s.downcase.include?("color")
          $stdout.tty? || color_terminal
        end

        if color?
          require 'ansi/code'

          include ::ANSI::Code
          extend ::ANSI::Code
        else
          def black(s = nil)
            block_given? ? yield : s
          end

          %w[ red green yellow blue magenta cyan white ].each do |color|
            alias_method color, :black
          end

          extend self
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
minitest-reporters-1.3.2.beta1 lib/minitest/reporters/ansi.rb
minitest-reporters-1.3.1 lib/minitest/reporters/ansi.rb
minitest-reporters-1.3.1.beta1 lib/minitest/reporters/ansi.rb