lib/tynn/static.rb in tynn-2.0.0.beta3 vs lib/tynn/static.rb in tynn-2.0.0.beta4

- old
+ new

@@ -1,29 +1,11 @@ # frozen_string_literal: true require "rack/static" class Tynn - # Serves static files (javascript files, images, stylesheets, etc). - # - # 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"]) - # Tynn.plugin(Tynn::Static, ["/js", "/css"], root: "assets") - # 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 - def self.setup(app, urls, opts = {}) # :nodoc: + def self.setup(app, urls, opts = {}) options = opts.dup options[:urls] ||= urls options[:root] ||= File.expand_path("public", Dir.pwd)