lib/tynn/static.rb in tynn-1.4.0 vs lib/tynn/static.rb in tynn-2.0.0.alpha

- old
+ new

@@ -1,36 +1,27 @@ +# frozen_string_literal: true + class Tynn - # Public: Adds support for static files (javascript files, images, - # stylesheets, etc). + # Serves static files (javascript files, images, stylesheets, etc). # - # Examples + # By default, these files are served from the <tt>./public</tt> folder. + # A different location can be specified through the <tt>:root</tt> option. # + # Under the hood, it uses the Rack::Static middleware. + # Thus, supports all the options available by the middleware. + # # require "tynn" # require "tynn/static" # # Tynn.plugin(Tynn::Static, ["/js", "/css"]) - # - # By default, serves all requests beginning with the given paths from - # the folder +public+ in the current directory (e.g. +public/js/*+, - # +public/css/*+). You can change the default by passing the +:root+ - # option. - # - # Examples - # # Tynn.plugin(Tynn::Static, ["/js", "/css"], root: "assets") - # - # Under the hood, it uses the +Rack::Static+ middleware. Thus, - # supports all the options available by the middleware. Check - # {Rack::Static}[http://www.rubydoc.info/gems/rack/Rack/Static] - # for more information. - # - # Examples - # # Tynn.plugin(Tynn::Static, ["/js", "/css"], index: "index.html") # + # For more information on the supported options, please see + # Rack::Static[http://www.rubydoc.info/gems/rack/Rack/Static]. + # module Static - # Internal: Configures Rack::Static middleware. - def self.setup(app, urls, opts = {}) + def self.setup(app, urls, opts = {}) # :nodoc: options = opts.dup options[:urls] ||= urls options[:root] ||= File.expand_path("public", Dir.pwd)