Class REXML::SourceFactory
In: 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 rexml/source.rb, line 9
    def SourceFactory::create_from(arg)
      if arg.kind_of? String
        Source.new(arg)
      elsif arg.respond_to? :read and
            arg.respond_to? :readline and
            arg.respond_to? :nil? and
            arg.respond_to? :eof?
        IOSource.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

[Validate]

ruby-doc.org is a service of James Britt and Happy Camper Studios, a Ruby application development company in Phoenix, AZ.

Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.

For more information on the Ruby programming language, visit ruby-lang.org.

Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.