summaryrefslogtreecommitdiff
path: root/lib/rexml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rexml')
-rw-r--r--lib/rexml/source.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/rexml/source.rb b/lib/rexml/source.rb
index bc99c0ed6a..659bcdc195 100644
--- a/lib/rexml/source.rb
+++ b/lib/rexml/source.rb
@@ -7,13 +7,14 @@ module REXML
# @param arg Either a String, or an IO
# @return a Source, or nil if a bad argument was given
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?
+ 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