module ActiveAnnotations::DocumentLoader
Public Class Methods
document_loader()
click to toggle source
# File lib/active_annotations/document_loader.rb, line 15 def document_loader ENV['NO_RDF_CACHE'] == '1' ? JSON::LD::API.method(:documentLoader) : self.method(:local_document_loader) end
local_document_loader(url, options={}) { |remote_document| ... }
click to toggle source
# File lib/active_annotations/document_loader.rb, line 4 def local_document_loader(url, options={}, &block) if RDF::URI(url) == RDF::URI(RDFAnnotation::CONTEXT_URI) remote_document = JSON::LD::API::RemoteDocument.new(File.read(File.expand_path('../oa.jsonld',__FILE__)), base: url) block_given? ? yield(remote_document) : remote_document else # :nocov: JSON::LD::API.documentLoader(url, options, &block) # :nocov: end end