Class: Ldpath::Loaders::Direct

Inherits:
Object
  • Object
show all
Defined in:
lib/ldpath/loaders/direct.rb

Instance Method Summary collapse

Instance Method Details

#load(uri) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/ldpath/loaders/direct.rb', line 2

def load(uri)
  Ldpath.logger.debug "Loading #{uri.inspect}"

  reader_types = RDF::Format.reader_types.reject { |t| t.to_s =~ /html/ }.map do |t|
    t.to_s =~ %r{text/(?:plain|html)} ? "#{t};q=0.5" : t
  end

  RDF::Graph.load(uri, headers: { 'Accept' => reader_types.join(", ") })
end