Sha256: 747eed1e32a0ea603ecb1ac322e7272cce8a1465d6019e264baf022b4d8928cc

Contents?: true

Size: 820 Bytes

Versions: 3

Compression:

Stored size: 820 Bytes

Contents

require 'rack'
require 'linkeddata'

module Rack
  module LinkedData
    autoload :ContentNegotiation, 'rack/linkeddata/conneg'
    autoload :VERSION,            'rack/linkeddata/version'

    ##
    # Registers all known RDF formats with Rack's MIME types registry.
    #
    # @param  [Hash{Symbol => Object}] options
    # @option options [Boolean]        :overwrite (false)
    # @return [void]
    def self.register_mime_types!(options = {})
      if defined?(Rack::Mime::MIME_TYPES)
        RDF::Format.file_extensions.each do |file_ext, content_type|
          if !Rack::Mime::MIME_TYPES.has_key?(file_ext = ".#{file_ext}") || options[:overwrite]
            Rack::Mime::MIME_TYPES.merge!(file_ext => content_type.to_s)
          end
        end
      end
    end
  end
end

Rack::LinkedData.register_mime_types!

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rack-linkeddata-0.3.0 lib/rack/linkeddata.rb
rack-linkeddata-0.2.0 lib/rack/linkeddata.rb
rack-linkeddata-0.1.2 lib/rack/linkeddata.rb