Class: REXML::SourceFactory
- Inherits:
-
Object
- Object
- REXML::SourceFactory
- Defined in:
- lib/rexml/source.rb
Overview
Generates Source-s. USE THIS CLASS.
Class Method Summary collapse
-
.create_from(arg) ⇒ Object
Generates a Source object.
Class Method Details
.create_from(arg) ⇒ Object
Generates a Source object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/rexml/source.rb', line 42 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 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 |