module Lucid::WindowsOutput

@private

Public Class Methods

extended(o) click to toggle source
# File lib/lucid/formatter/unicode.rb, line 24
def self.extended(o)
  o.instance_eval do

    def lucid_preprocess_output(*a)
      begin
        a.map{|arg| arg.to_s.encode(Encoding.default_external)}
      rescue Encoding::UndefinedConversionError => e
        STDERR.lucid_puts("WARNING: #{e.message}")
        a
      end
    end

    alias lucid_print print
    def print(*a)
      lucid_print(*lucid_preprocess_output(*a))
    end

    alias lucid_puts puts
    def puts(*a)
      lucid_puts(*lucid_preprocess_output(*a))
    end
  end
end

Public Instance Methods

lucid_preprocess_output(*a) click to toggle source
# File lib/lucid/formatter/unicode.rb, line 27
def lucid_preprocess_output(*a)
  begin
    a.map{|arg| arg.to_s.encode(Encoding.default_external)}
  rescue Encoding::UndefinedConversionError => e
    STDERR.lucid_puts("WARNING: #{e.message}")
    a
  end
end
print(*a) click to toggle source
puts(*a) click to toggle source
# File lib/lucid/formatter/unicode.rb, line 42
def puts(*a)
  lucid_puts(*lucid_preprocess_output(*a))
end