Class
Generates Source-s. USE THIS CLASS.
Class Methods
lib/rexml/source.rb
View on GitHub
# File tmp/rubies/ruby-2.6.10/lib/rexml/source.rb, line 11
def SourceFactory::create_from(arg)
if arg.respond_to? :read and
arg.respond_to? :readline and
arg.respond_to? :nil? and
arg.respond_to? :eof?
IOSource.new(arg)
elsif arg.respond_to? :to_str
require 'stringio'
IOSource.new(StringIO.new(arg))
elsif arg.kind_of? Source
arg
else
raise "#{arg.class} is not a valid input stream. It must walk \n"+
"like either a String, an IO, or a Source."
end
end