Sha256: 3bcc2bab9c85d36c783a0e2bf7ec79078b52b5c040b4ed07de129cba2d3beb6f

Contents?: true

Size: 1022 Bytes

Versions: 5

Compression:

Stored size: 1022 Bytes

Contents

require 'sinatra/base'
require 'rack/rdf'

module Sinatra
  ##
  # To override negotiation on Content-Type, set :format in `linkeddata_options` to a RDF Format class, or symbol identifying a format.
  #
  # @see https://www.sinatrarb.com/extensions.html
  module RDF
    autoload :VERSION, 'sinatra/rdf/version'

    ##
    # Helper methods.
    module Helpers
      # TODO
    end

    ##
    # * Registers Rack::LinkedData::ContentNegotiation
    # * adds helpers
    # * includes RDF and LinkedData
    # * defines `linkeddata_options`, which are passed to the Rack middleware
    #   available as `settings.linkeddata_options` and as options within
    #   the LinkedData Rack middleware.
    #
    # @param  [Sinatra::Base] app
    # @return [void]
    def self.registered(app)
      options = {}
      app.set :linkeddata_options, options
      app.use(Rack::RDF::ContentNegotiation, options)
      app.helpers(Sinatra::RDF::Helpers)
      app.send(:include, ::RDF)
    end
  end
end

Sinatra.register(Sinatra::RDF)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sinatra-rdf-3.3.1 lib/sinatra/rdf.rb
sinatra-rdf-3.3.0 lib/sinatra/rdf.rb
sinatra-rdf-3.2.1 lib/sinatra/rdf.rb
sinatra-rdf-3.1.2 lib/sinatra/rdf.rb
sinatra-rdf-3.1.1 lib/sinatra/rdf.rb