Module: Turn::Colorize

### Home Classes Methods

### In Files

- lib/turn/colorize.rb

### Methods

- ::blue
- ::bold
- ::color_supported?
- ::colorize?
- ::error
- ::fail
- ::green
- ::included
- ::magenta
- ::mark
- ::pass
- ::red
- ::skip
- #colorize?

### Files

- History.txt
- LICENSE.txt
- Release.txt
- Version.txt

### Class/Module Index

Quicksearch

- Turn
- Turn::Colorize
- Turn::Command
- Turn::Configuration
- Turn::Controller
- Turn::CrossRunner
- Turn::CueReporter
- Turn::DotReporter
- Turn::IsoRunner
- Turn::MarshalReporter
- Turn::MiniRunner
- Turn::OutlineReporter
- Turn::PrettyReporter
- Turn::ProgressReporter
- Turn::Reporter
- Turn::SoloRunner
- Turn::TestCase
- Turn::TestMethod
- Turn::TestRunner
- Turn::TestSuite
- Turn::ToptenDecorator
- Test
- Test::Unit
- Test::Unit::Failure
- Object
- String

No matching classes.

# Turn::Colorize

Provides a uniform interface for colorizing Turn output.

### Constants

COLORLESS_TERMINALS

### Public Class Methods

blue(string) click to toggle source

    # File lib/turn/colorize.rb, line 57
    def self.blue(string)
      colorize? ? ::ANSI::Code.blue{ string } : string
    end

bold(string) click to toggle source

    # File lib/turn/colorize.rb, line 65
    def self.bold(string)
      colorize? ? ::ANSI::Code.bold{ string } : string
    end

color_supported?() click to toggle source

Does the system support color?

    # File lib/turn/colorize.rb, line 41
    def self.color_supported?
      return false unless defined?(::ANSI::Code)
      return false unless $stdout.tty?
      return true if ENV.has_key?('TERM') && !COLORLESS_TERMINALS.include?(ENV['TERM'])
      return true if ::RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ && ENV.has_key?('ANSICON')
      return false
    end

colorize?() click to toggle source

Colorize output or not?

    # File lib/turn/colorize.rb, line 32
    def self.colorize?
      return @colorize unless @colorize.nil?
      @colorize ||= (
        ansi = Turn.config.ansi?
        ansi.nil? ? color_supported? : ansi
      )
    end

error(string) click to toggle source

    # File lib/turn/colorize.rb, line 81
    def self.error(string)
      #colorize? ? ::ANSI::Code.white_on_red{ string } : string
      colorize? ? ::ANSI::Code.yellow{ string } : string
    end

fail(string) click to toggle source

    # File lib/turn/colorize.rb, line 77
    def self.fail(string)
      colorize? ? ::ANSI::Code.red{ string } : string
    end

green(string) click to toggle source

    # File lib/turn/colorize.rb, line 53
    def self.green(string)
      colorize? ? ::ANSI::Code.green{ string } : string
    end

included(base) click to toggle source

    # File lib/turn/colorize.rb, line 20
    def self.included(base)
      base.module_eval do
        const_set :PASS,  Colorize.pass('PASS')
        const_set :FAIL,  Colorize.fail('FAIL')
        const_set :ERROR, Colorize.error('ERROR')
        const_set :SKIP,  Colorize.skip('SKIP')
      end
    end

magenta(string) click to toggle source

    # File lib/turn/colorize.rb, line 61
    def self.magenta(string)
      colorize? ? ::ANSI::Code.magenta{ string } : string
    end

mark(string) click to toggle source

    # File lib/turn/colorize.rb, line 69
    def self.mark(string)
      colorize? ? ::ANSI::Code.yellow{ string } : string
    end

pass(string) click to toggle source

    # File lib/turn/colorize.rb, line 73
    def self.pass(string)
      colorize? ? ::ANSI::Code.green{ string } : string
    end

red(string) click to toggle source

    # File lib/turn/colorize.rb, line 49
    def self.red(string)
      colorize? ? ::ANSI::Code.red{ string } : string
    end

skip(string) click to toggle source

    # File lib/turn/colorize.rb, line 86
    def self.skip(string)
      colorize? ? ::ANSI::Code.cyan{ string } : string
    end

### Public Instance Methods

colorize?() click to toggle source

    # File lib/turn/colorize.rb, line 90
    def colorize?
      Colorize.colorize?
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.