lib/rack/linkeddata.rb in rack-linkeddata-0.3.0 vs lib/rack/linkeddata.rb in rack-linkeddata-1.0.0
- old
+ new
@@ -12,12 +12,17 @@
# @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|
+ RDF::Format.each do |format|
+ if !Rack::Mime::MIME_TYPES.has_key?(file_ext = ".#{format.to_sym}") || options[:overwrite]
+ Rack::Mime::MIME_TYPES.merge!(file_ext => format.content_type.first)
+ end
+ end
+ RDF::Format.file_extensions.each do |file_ext, formats|
if !Rack::Mime::MIME_TYPES.has_key?(file_ext = ".#{file_ext}") || options[:overwrite]
- Rack::Mime::MIME_TYPES.merge!(file_ext => content_type.to_s)
+ Rack::Mime::MIME_TYPES.merge!(file_ext => formats.first.content_type.first)
end
end
end
end
end