lib/rdf_context/parser.rb in rdf_context-0.5.9.1 vs lib/rdf_context/parser.rb in rdf_context-0.5.10
- old
+ new
@@ -1,7 +1,5 @@
-require File.join(File.dirname(__FILE__), 'graph')
-
module RdfContext
# Generic RdfContext Parser class
class Parser
attr_reader :debug
@@ -129,11 +127,11 @@
when /\.(rdf|xml)$/ then :rdfxml
when /\.(html|xhtml)$/ then :rdfa
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
else
string = stream.to_s
@@ -143,9 +141,10 @@
when /<RDF/ then :rdfxml
when /<html/i then :rdfa
else :n3
end
end
+ format
end
protected
# Figure out the document path, if it is a Nokogiri::XML::Element or Attribute
def node_path(node)