Module: Cucumber::WindowsOutput

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

Class Method Summary collapse

Class Method Details

.extended(o) ⇒ Object



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

def self.extended(o)
  o.instance_eval do
    def cucumber_preprocess_output(*a)
      begin
        a.map { |arg| arg.to_s.encode(Encoding.default_external) }
      rescue Encoding::UndefinedConversionError => e
        STDERR.cucumber_puts("WARNING: #{e.message}")
        a
      end
    end

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

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