lib/roda/plugins/public.rb in roda-3.59.0 vs lib/roda/plugins/public.rb in roda-3.60.0
- old
+ new
@@ -3,13 +3,11 @@
require 'uri'
begin
require 'rack/files'
rescue LoadError
- # :nocov:
require 'rack/file'
- # :nocov:
end
#
class Roda
module RodaPlugins
@@ -43,13 +41,11 @@
# end
# end
module Public
SPLIT = Regexp.union(*[File::SEPARATOR, File::ALT_SEPARATOR].compact)
PARSER = URI::DEFAULT_PARSER
- # :nocov:
RACK_FILES = defined?(Rack::Files) ? Rack::Files : Rack::File
- # :nocov:
# Use options given to setup a Rack::File instance for serving files. Options:
# :default_mime :: The default mime type to use if the mime type is not recognized.
# :gzip :: Whether to serve already gzipped files with a .gz extension for clients
# supporting gzipped transfer encoding.
@@ -140,16 +136,14 @@
# Serve the given path using the given Rack::Files server.
def public_serve(server, path)
server.serving(self, path)
end
else
- # :nocov:
def public_serve(server, path)
server = server.dup
server.path = path
server.serving(env)
end
- # :nocov:
end
end
end
register_plugin(:public, Public)