class Goliath::Chimp::Rack::Validation::Routes
Attributes
printable_route[R]
route_regex[R]
Public Class Methods
new(app, regex, printable = nil)
click to toggle source
# File lib/goliath/chimp/rack/validation/routes.rb, line 8 def initialize(app, regex, printable = nil) @app = app @route_regex = regex @printable_route = printable || regex.inspect end
Public Instance Methods
call(env)
click to toggle source
# File lib/goliath/chimp/rack/validation/routes.rb, line 14 def call env if path = env[Goliath::Request::REQUEST_PATH].match(route_regex) env['routes'] ||= {} path.names.each do |segment| env['routes'][segment.to_sym] = path[segment] end @app.call env else validation_error(400, "Invalid route. Must match #{printable_route}") end end