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
aslakhellesoy-cucumber-0.3.100 lib/cucumber/formatter/color_io.rb
aslakhellesoy-cucumber-0.3.101.2 lib/cucumber/formatter/color_io.rb
aslakhellesoy-cucumber-0.3.101 lib/cucumber/formatter/color_io.rb
aslakhellesoy-cucumber-0.3.102.1 lib/cucumber/formatter/color_io.rb
aslakhellesoy-cucumber-0.3.102.2 lib/cucumber/formatter/color_io.rb
aslakhellesoy-cucumber-0.3.102 lib/cucumber/formatter/color_io.rb
aslakhellesoy-cucumber-0.3.103 lib/cucumber/formatter/color_io.rb
aslakhellesoy-cucumber-0.3.104 lib/cucumber/formatter/color_io.rb
aslakhellesoy-cucumber-0.3.97 lib/cucumber/formatter/color_io.rb
aslakhellesoy-cucumber-0.3.98 lib/cucumber/formatter/color_io.rb
aslakhellesoy-cucumber-0.3.99 lib/cucumber/formatter/color_io.rb
dwaite-cucumber-0.3.101 lib/cucumber/formatter/color_io.rb
engineyard-cucumber-0.3.101 lib/cucumber/formatter/color_io.rb
kosmas58-cucumber-0.3.100 lib/cucumber/formatter/color_io.rb
kosmas58-cucumber-0.3.102 lib/cucumber/formatter/color_io.rb
kosmas58-cucumber-0.3.103 lib/cucumber/formatter/color_io.rb
kosmas58-cucumber-0.3.97 lib/cucumber/formatter/color_io.rb
kosmas58-cucumber-0.3.98 lib/cucumber/formatter/color_io.rb
kosmas58-cucumber-0.3.99 lib/cucumber/formatter/color_io.rb
cucumber-0.4.5.rc2 lib/cucumber/formatter/color_io.rb