Sha256: afdb806e738b0676dd175e9b198f5123b3aa5aea9fe330084eba7ac643f8b09d

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 KB

Contents

require 'sinatra/base'
require 'rack/linkeddata'

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 LinkedData
    autoload :VERSION, 'sinatra/linkeddata/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::LinkedData::ContentNegotiation, options)
      app.helpers(Sinatra::LinkedData::Helpers)
      app.send(:include, ::RDF)
      app.send(:include, ::LinkedData)
    end
  end
end

Sinatra.register(Sinatra::LinkedData)

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sinatra-linkeddata-3.3.1 lib/sinatra/linkeddata.rb
sinatra-linkeddata-3.3.0 lib/sinatra/linkeddata.rb
sinatra-linkeddata-3.2.1 lib/sinatra/linkeddata.rb
sinatra-linkeddata-3.2.0 lib/sinatra/linkeddata.rb
sinatra-linkeddata-3.1.3 lib/sinatra/linkeddata.rb
sinatra-linkeddata-3.1.2 lib/sinatra/linkeddata.rb
sinatra-linkeddata-3.1.1 lib/sinatra/linkeddata.rb