new(arg, block_size=500, encoding=nil)
public
block_size has been deprecated
Show source
def initialize(arg, block_size=500, encoding=nil)
@er_source = @source = arg
@to_utf = false
@buffer = ""
str = @source.read( 2 )
if encoding
self.encoding = encoding
elsif 0xfe == str[0] && 0xff == str[1]
@line_break = "\000>"
elsif 0xff == str[0] && 0xfe == str[1]
@line_break = ">\000"
elsif 0xef == str[0] && 0xbb == str[1]
str += @source.read(1)
str = '' if (0xbf == str[2])
@line_break = ">"
else
@line_break = ">"
end
super str+@source.readline( @line_break )
end