Class REXML::SourceFactory
In: lib/rexml/source.rb
Parent: Object

Generates Source-s. USE THIS CLASS.

Methods

Public Class methods

Generates a Source object @param arg Either a String, or an IO @return a Source, or nil if a bad argument was given

[Source]

    # File lib/rexml/source.rb, line 9
 9:     def SourceFactory::create_from(arg)
10:       if arg.kind_of? String
11:         Source.new(arg)
12:       elsif arg.respond_to? :read and
13:             arg.respond_to? :readline and
14:             arg.respond_to? :nil? and
15:             arg.respond_to? :eof?
16:         IOSource.new(arg)
17:       elsif arg.kind_of? Source
18:         arg
19:       else
20:         raise "#{arg.class} is not a valid input stream.  It must walk \n"+
21:           "like either a String, an IO, or a Source."
22:       end
23:     end

[Validate]