Sha256: 73be03e9e697cad1f61f23ac57212234b0db51738cb7de1423914139448118bc

Contents?: true

Size: 540 Bytes

Versions: 74

Compression:

Stored size: 540 Bytes

Contents

require 'forwardable'

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

      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

74 entries across 74 versions & 6 rubygems

Version Path
aslakhellesoy-cucumber-0.3.7.5 lib/cucumber/formatter/color_io.rb
aslakhellesoy-cucumber-0.3.7 lib/cucumber/formatter/color_io.rb
aslakhellesoy-cucumber-0.3.8 lib/cucumber/formatter/color_io.rb
aslakhellesoy-cucumber-0.3.9.1 lib/cucumber/formatter/color_io.rb
aslakhellesoy-cucumber-0.3.9.2 lib/cucumber/formatter/color_io.rb
aslakhellesoy-cucumber-0.3.9.3 lib/cucumber/formatter/color_io.rb
aslakhellesoy-cucumber-0.3.9.4 lib/cucumber/formatter/color_io.rb
aslakhellesoy-cucumber-0.3.9.5 lib/cucumber/formatter/color_io.rb
aslakhellesoy-cucumber-0.3.9 lib/cucumber/formatter/color_io.rb
cavalle-cucumber-0.2.3.3.1 lib/cucumber/formatter/color_io.rb
cavalle-cucumber-0.2.3.3.2 lib/cucumber/formatter/color_io.rb
fcoury-cucumber-0.2.3.1 lib/cucumber/formatter/color_io.rb
kosmas58-cucumber-0.1.100.5 lib/cucumber/formatter/color_io.rb
kosmas58-cucumber-0.1.99.23 lib/cucumber/formatter/color_io.rb
kosmas58-cucumber-0.2.0.1 lib/cucumber/formatter/color_io.rb
kosmas58-cucumber-0.2.0 lib/cucumber/formatter/color_io.rb
kosmas58-cucumber-0.2.2.1 lib/cucumber/formatter/color_io.rb
kosmas58-cucumber-0.2.3.3 lib/cucumber/formatter/color_io.rb
kosmas58-cucumber-0.3.9.4 lib/cucumber/formatter/color_io.rb
notch8-cucumber-0.1.99.23 lib/cucumber/formatter/color_io.rb