Google

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 @closed = nil @document_status = nil @tags = [] @stack = [] @entities = [] end