Class: ESS::Validation::URLValidation
- Inherits:
-
Object
- Object
- ESS::Validation::URLValidation
show all
- Defined in:
- lib/ess/validation.rb
Instance Method Summary
collapse
Instance Method Details
#validate_url(text) ⇒ Object
60
61
62
63
64
65
66
|
# File 'lib/ess/validation.rb', line 60
def validate_url text
unless text =~ /^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i || text.length > 10
unless isValidIP text
raise ValidationError, "invalid URL: #{text}"
end
end
end
|