Method: REXML::IOSource#initialize

Defined in:
lib/rexml/source.rb

#initialize(arg, block_size = 500, encoding = nil) ⇒ IOSource

block_size has been deprecated



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/rexml/source.rb', line 162

def initialize(arg, block_size=500, encoding=nil)
  @er_source = @source = arg
  @to_utf = false
  @pending_buffer = nil

  if encoding
    super("", encoding)
  else
    super(@source.read(3) || "")
  end

  if !@to_utf and
      @buffer.respond_to?(:force_encoding) and
      @source.respond_to?(:external_encoding) and
      @source.external_encoding != ::Encoding::UTF_8
    @force_utf8 = true
  else
    @force_utf8 = false
  end
end