Sha256: 4cfb98db85e8b959d4666641982d11e8ce8bc718271a5bed682c6be4d42e0dca
Contents?: true
Size: 623 Bytes
Versions: 3
Compression:
Stored size: 623 Bytes
Contents
# encoding: utf-8 module DataMapper module Validate module Format module Url def self.included(base) DataMapper::Validate::FormatValidator::FORMATS.merge!( :url => [ Url, lambda { |field, value| '%s is not a valid URL'.t(value) }] ) end Url = begin # Regex from http://www.igvita.com/2006/09/07/validating-url-in-ruby-on-rails/ /(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}((\:[0-9]{1,5})?\/?.*)?$)/ix end end # module Url end # module Format end # module Validate end # module DataMapper
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dm-validations-0.10.2 | lib/dm-validations/formats/url.rb |
dm-validations-0.10.1 | lib/dm-validations/formats/url.rb |
dm-validations-0.10.0 | lib/dm-validations/formats/url.rb |