lib/rack/ldp.rb in rdf-ldp-1.0.1 vs lib/rack/ldp.rb in rdf-ldp-2.1.0
- old
+ new
@@ -32,11 +32,11 @@
# use Rack::LDP::Responses
# use Rack::LDP::Requests
# # ...
# end
#
- # @see http://www.w3.org/TR/ldp/ the LDP specification
+ # @see https://www.w3.org/TR/ldp/ the LDP specification
module LDP
##
# Catches and handles RequestErrors thrown by RDF::LDP
class Errors
##
@@ -51,11 +51,11 @@
#
# @param [Array] env a rack env array
# @return [Array] a rack env array with added headers
def call(env)
@app.call(env)
- rescue RDF::LDP::RequestError => err
+ rescue ::RDF::LDP::RequestError => err
return [err.status, err.headers, [err.message]]
end
end
##
@@ -70,11 +70,11 @@
##
# Converts the response body from {RDF::LDP::Resource} form to a Graph
def call(env)
status, headers, response = @app.call(env)
- if response.is_a? RDF::LDP::Resource
+ if response.is_a? ::RDF::LDP::Resource
new_response = response.to_response
response.close if response.respond_to? :close
response = new_response
end
@@ -98,25 +98,25 @@
# @param [Array] env a rack env array
# @return [Array] a rack env array with added headers
def call(env)
status, headers, response = @app.call(env)
return [status, headers, response] unless
- response.is_a? RDF::LDP::Resource
+ response.is_a? ::RDF::LDP::Resource
response
.send(:request, env['REQUEST_METHOD'].to_sym, status, headers, env)
end
end
##
- # Specializes {Rack::LinkedData::ContentNegotiation}, making the default
+ # Specializes `Rack::LinkedData::ContentNegotiation`, making the default
# return type 'text/turtle'.
#
- # @see Rack::LinkedData::ContentNegotiation}, making
+ # @see Rack::LinkedData::ContentNegotiation, making
class ContentNegotiation < Rack::LinkedData::ContentNegotiation
DEFAULT_PREFIXES =
- Hash[*RDF::Vocabulary.map { |v| [v.__prefix__, v.to_uri] }.flatten]
+ Hash[*::RDF::Vocabulary.map { |v| [v.__prefix__, v.to_uri] }.flatten]
.freeze
def initialize(app, options = {})
options[:default] ||= 'text/turtle'
options[:prefixes] ||= DEFAULT_PREFIXES.dup
@@ -128,10 +128,10 @@
# patch in support for 'text/*' manually, giving Turtle. This should be
# considered helpful by LDP clients.
#
# @see Rack::LinkedData::ContentNegotiation#find_writer_for_content_type
def find_writer_for_content_type(content_type)
- return [RDF::Writer.for(:ttl), 'text/turtle'] if
+ return [::RDF::Writer.for(:ttl), 'text/turtle'] if
content_type == 'text/*'
super
end
end
end