Sha256: 9511ef0f6c728f4c4501f5199f56db1ba604a2cb25b350218b81ee43a76205a9

Contents?: true

Size: 696 Bytes

Versions: 8

Compression:

Stored size: 696 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

8 entries across 8 versions & 2 rubygems

Version Path
minitest-reporters-1.3.6 lib/minitest/reporters/ansi.rb
nullifyable-0.1.0 vendor/bundle/gems/minitest-reporters-1.3.5/lib/minitest/reporters/ansi.rb
minitest-reporters-1.3.5 lib/minitest/reporters/ansi.rb
minitest-reporters-1.3.5.beta1 lib/minitest/reporters/ansi.rb
minitest-reporters-1.3.4 lib/minitest/reporters/ansi.rb
minitest-reporters-1.3.3 lib/minitest/reporters/ansi.rb
minitest-reporters-1.3.2 lib/minitest/reporters/ansi.rb
minitest-reporters-1.3.2.beta2 lib/minitest/reporters/ansi.rb