Sha256: b5145e489bb89666871a4b57c50c8412929b0c82bc6cb6f765c36b58cdecc586

Contents?: true

Size: 566 Bytes

Versions: 41

Compression:

Stored size: 566 Bytes

Contents

require 'forwardable'

module Cucumber
  module Formatter
    # Adapter to make #puts/#print/#flush work with colours on Windows
    class ColorIO #:nodoc:
      extend Forwardable
      def_delegators :@kernel, :puts, :print # win32console colours only work when sent to Kernel
      def_delegators :@stdout, :flush, :tty?, :write, :close

      def initialize
        @kernel = Kernel
        @stdout = STDOUT
      end

      # Ensure using << still gets colours in win32console
      def <<(output)
        print(output)
        self
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 8 rubygems

Version Path
cucumber-0.3.97 lib/cucumber/formatter/color_io.rb