Module: Lively::Environment::Middleware
- Included in:
- Application, HTTP, HTTY
- Defined in:
- lib/lively/environment/middleware.rb
Overview
Instance Method Summary collapse
-
#application ⇒ Object
Resolve the application class to use.
-
#middleware ⇒ Object
Build the middleware stack for this application.
-
#root ⇒ Object
Get the root directory for this application.
Instance Method Details
#application ⇒ Object
Resolve the application class to use.
28 29 30 31 32 33 34 35 |
# File 'lib/lively/environment/middleware.rb', line 28 def application if Object.const_defined?(:Application) Object.const_get(:Application) else Console.warn(self, "No Application class defined, using default.") ::Lively::Application end end |
#middleware ⇒ Object
Build the middleware stack for this application.
39 40 41 42 43 44 45 |
# File 'lib/lively/environment/middleware.rb', line 39 def middleware ::Protocol::HTTP::Middleware.build do |builder| builder.use Lively::Assets, root: File.("public", self.root) builder.use Lively::Assets, root: File.("../../../public", __dir__) builder.use self.application end end |
#root ⇒ Object
Get the root directory for this application.
22 23 24 |
# File 'lib/lively/environment/middleware.rb', line 22 def root Dir.pwd end |