Module: Cucumber::WindowsOutput

Extended by:
WindowsOutput
Included in:
WindowsOutput
Defined in:
lib/cucumber/formatter/unicode.rb

Class Method Summary collapse

Class Method Details

.extended(output) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/cucumber/formatter/unicode.rb', line 26

def self.extended(output)
  output.instance_eval do
    def cucumber_preprocess_output(*out)
      out.map { |arg| arg.to_s.encode(Encoding.default_external) }
    rescue Encoding::UndefinedConversionError => e
      $stderr.cucumber_puts("WARNING: #{e.message}")
      out
    end

    alias cucumber_print print
    def print(*out)
      cucumber_print(*cucumber_preprocess_output(*out))
    end

    alias cucumber_puts puts
    def puts(*out)
      cucumber_puts(*cucumber_preprocess_output(*out))
    end
  end
end