Sha256: 093bf932ec50ef5bb8ceb5d24d2206beb9f313202b3d7fd4eb961adeb400103c

Contents?: true

Size: 550 Bytes

Versions: 4

Compression:

Stored size: 550 Bytes

Contents

# frozen_string_literal: false
require 'rexml/encoding'

module REXML
  class Output
    include Encoding

    attr_reader :encoding

    def initialize real_IO, encd="iso-8859-1"
      @output = real_IO
      self.encoding = encd

      @to_utf = encoding != 'UTF-8'

      if encoding == "UTF-16"
        @output << "\ufeff".encode("UTF-16BE")
        self.encoding = "UTF-16BE"
      end
    end

    def <<( content )
      @output << (@to_utf ? self.encode(content) : content)
    end

    def to_s
      "Output[#{encoding}]"
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
rho-tau-extensions-7.6.0 libs/rexml-edge/rexml/output.rb
rho-tau-extensions-7.4.1 libs/rexml-edge/rexml/output.rb
rho-tau-extensions-7.1.17 libs/rexml-edge/rexml/output.rb
ruby-compiler-0.1.1 vendor/ruby/lib/rexml/output.rb