Class: JsRoutes::Middleware
- Inherits:
-
Object
- Object
- JsRoutes::Middleware
- Extended by:
- T::Sig
- Includes:
- Types, RackApp
- Defined in:
- lib/js_routes/middleware.rb
Overview
A Rack middleware that automatically updates routes file whenever routes.rb is modified
Inspired by github.com/fnando/i18n-js/blob/v3/lib/i18n/js/middleware.rb
Constant Summary
Constants included from Types
Types::Application, Types::ApplicationCaller, Types::BannerCaller, Types::Clusivity, Types::ConfigurationBlock, Types::FileName, Types::JourneyRoute, Types::Literal, Types::Options, Types::Prefix, Types::RouteSpec, Types::SpecNode, Types::StringArray, Types::StringHash, Types::SymbolArray, Types::UntypedArray
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
17 18 19 20 |
# File 'lib/js_routes/middleware.rb', line 17 def initialize(app) @app = app @digest = T.let(nil, T.nilable(String)) end |
Instance Method Details
#call(env) ⇒ Object
23 24 25 26 |
# File 'lib/js_routes/middleware.rb', line 23 def call(env) update_js_routes @app.call(env) end |