Skip to content

Instantly share code, notes, and snippets.

@dabit
Created February 1, 2013 19:04
Show Gist options
  • Save dabit/4693322 to your computer and use it in GitHub Desktop.
Save dabit/4693322 to your computer and use it in GitHub Desktop.
def matches?(env)
req = @request.new(env)
@constraints.each { |constraint|
if constraint.respond_to?(:matches?) && !constraint.matches?(req)
return false
elsif constraint.respond_to?(:call) && !constraint.call(*constraint_args(constraint, req))
return false
end
}
return true
ensure
req.reset_parameters
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment