Class: Itsi::Server::Config::Run
- Inherits:
-
Middleware
- Object
- Middleware
- Itsi::Server::Config::Run
- Defined in:
- lib/itsi/server/config/middleware/run.rb
Instance Method Summary collapse
- #build! ⇒ Object
-
#initialize(location, app, params = {}) ⇒ Run
constructor
A new instance of Run.
Methods included from ConfigHelpers
included, load_and_register, #normalize_keys!
Constructor Details
#initialize(location, app, params = {}) ⇒ Run
Returns a new instance of Run.
23 24 25 26 27 |
# File 'lib/itsi/server/config/middleware/run.rb', line 23 def initialize(location, app, params={}) super(location, params) raise "App must be a Rack application" unless app.respond_to?(:call) @app = app end |
Instance Method Details
#build! ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/itsi/server/config/middleware/run.rb', line 29 def build! app_args = { preloader: -> { Itsi::Server::RackInterface.for(@app) }, sendfile: @params[:sendfile], nonblocking: @params[:nonblocking], script_name: @params[:script_name], base_path: "^(?<base_path>#{location.paths_from_parent.gsub(/\.\*\)$/, ')')}).*$" } location.middleware[:app] = app_args location.location("*") do @middleware[:app] = app_args end end |