Maintenance of Ruby 2.0.0 will end on February 24, 2016. Read more

In Files

  • rexml/source.rb



Class/Module Index [+]



Generates Source-s. USE THIS CLASS.

Public Class Methods

create_from(arg) click to toggle source

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

               # File rexml/source.rb, line 9
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?
  elsif arg.respond_to? :to_str
    require 'stringio'
  elsif arg.kind_of? Source
    raise "#{arg.class} is not a valid input stream.  It must walk \n"+
      "like either a String, an IO, or a Source."

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit

blog comments powered by Disqus