Class: OpenapiBlocks::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi_blocks/middleware.rb

Overview

rubocop:disable Style/Documentation

Constant Summary collapse

CACHE_KEY =
:openapi_spec

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



10
11
12
13
14
# File 'lib/openapi_blocks/middleware.rb', line 10

def initialize(app)
  @app          = app
  @cache        = Cache.new
  @file_watcher = FileWatcher.new(root_path)
end

Instance Method Details

#call(env) ⇒ Object



16
17
18
19
20
# File 'lib/openapi_blocks/middleware.rb', line 16

def call(env)
  @app.call(env)
ensure
  invalidate_if_stale!
end