# File rexml/pullparser.rb, line 22 def initialize stream if stream.kind_of? String @source = Source.new stream elsif stream.kind_of? IO @source = IOSource.new stream elsif stream.kind_of? Source @source = stream else raise "#{stream.type} is not a valid input stream. It must be \n"+ "either a String, IO, or Source." end listener = PullListener.new(self) @main = Thread.current @thread = Thread.new { begin Document::parse_stream( @source, listener ) rescue REXML::ParseException @value = PullEvent.new( error:error, $!.message ) end } Thread.pass end