class Rack::LDP::ContentNegotiation

Specializes {Rack::LinkedData::ContentNegotiation}, making the default return type 'text/turtle'.

@see Rack::LinkedData::ContentNegotiation}, making

Constants

DEFAULT_PREFIXES

Public Class Methods

new(app, options = {}) click to toggle source
Calls superclass method
# File lib/rack/ldp.rb, line 120
def initialize(app, options = {})
  options[:default] ||= 'text/turtle'
  options[:prefixes] ||= DEFAULT_PREFIXES.dup
  super
end

Public Instance Methods

find_writer_for_content_type(content_type) click to toggle source

The default LinkedData Conneg doesn't support wildcard operators. We 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

Calls superclass method
# File lib/rack/ldp.rb, line 132
def find_writer_for_content_type(content_type)
  return [RDF::Writer.for(:ttl), 'text/turtle'] if
    content_type == 'text/*'
  super
end