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



6
7
8
9
10
11
12
13
14
# File 'lib/ldpath/loaders/direct.rb', line 6

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

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

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