Class: StrongRoutes::Allow

Inherits:
Object
  • Object
show all
Defined in:
lib/strong_routes/allow.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Allow

Returns a new instance of Allow.



3
4
5
# File 'lib/strong_routes/allow.rb', line 3

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/strong_routes/allow.rb', line 7

def call(env)
  return @app.call(env) unless config.enabled?

  if StrongRoutes.allowed?(env[Rack::PATH_INFO].to_s)
    @app.call(env)
  else
    StrongRoutes.response
  end
end