cesario/activevalidators — pull request #37 by lwe (2012-04-30 10:40:15+00:00)
Title: replace custom url regexp with URI.regexp

Thanks for the nice collection of ActiveModel validators.

I've refactored the UriValidator to make use of URI.regexp to verify URLs. This allows for further customizations, like only allowing certain protocols, or creating a strict mode which does not allow userinfo, or custom ports.

The refactord UriValidator can take an array as argument which is the list of allowed protocols, the default is to only allow `http` and `https` URLs.

```ruby
validates :url, :url => true
# => only allows http, https

validates :url, :url => %w{ftp ftps}
# => only allows ftp, ftps
```

Tried to add documentation to all methods (tomdoc) and I've added a few tests (empty URLs, protocols) - the existing test suite works as expected. So unless somebody is using schemes other than http/https the refactored UriValidator works the same as before.