Class: Inverter::Middleware

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



3
4
5
# File 'lib/inverter/middleware.rb', line 3

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/inverter/middleware.rb', line 7

def call(env)
  # workaround this method so no need to call it if:
  #  - not GET request
  #  - not action request (assets or public files)

  if ! Inverter.disable_middleware
    Inverter.model_class.sync_with_templates!
  end

  @app.call(env)
end