Permalink
Browse files

Improve Parser#detect_format for Tempfiles.

  • Loading branch information...
1 parent a6d6545 commit 61275fc9d6cd27f8358c15d488762d78f8b7f4b4 @gkellogg committed Dec 20, 2010
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/rdf_context/parser.rb
@@ -129,7 +129,7 @@ def detect_format(stream, uri = nil)
when /\.(nt|n3|txt)$/ then :n3
else
# Got to look into the file to see
- if stream.is_a?(IO) || stream.is_a?(StringIO)
+ if stream.respond_to?(:read)
stream.rewind
string = stream.read(1000)
stream.rewind
@@ -143,6 +143,7 @@ def detect_format(stream, uri = nil)
else :n3
end
end
+ format
end
protected

0 comments on commit 61275fc

Please sign in to comment.