Class: ClientSideValidations::Middleware::Validators

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Validators

Returns a new instance of Validators.



8
9
10
# File 'lib/client_side_validations/middleware.rb', line 8

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/client_side_validations/middleware.rb', line 12

def call(env)
  case env['PATH_INFO']
  when %r{\/validators\/(\w+)\.json}
    "::ClientSideValidations::Middleware::#{$1.camelize}".constantize.new(env).response
  else
    @app.call(env)
  end
end