Class: Rys::FeaturePreload

Inherits:
Object
  • Object
show all
Defined in:
app/middleware/rys/feature_preload.rb

Overview

Rys::FeaturePreload

Save features used in specific action (e.g. '/issues') to preload them at once on the same action in the future.

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ FeaturePreload


12
13
14
15
16
# File 'app/middleware/rys/feature_preload.rb', line 12

def initialize(app)
  @app = app
  @mutex = Mutex.new
  @features_for_paths = {}
end

Instance Method Details

#call(env) ⇒ Object


18
19
20
21
22
23
24
# File 'app/middleware/rys/feature_preload.rb', line 18

def call(env)
  load_features(env)
  response = @app.call(env)
  save_features(env)

  response
end