Module: Validators
- Defined in:
- lib/validators.rb,
lib/validators/ip.rb,
lib/validators/tld.rb,
lib/validators/version.rb,
lib/validators/hostname.rb,
lib/validators/constants.rb,
lib/validators/disposable_emails.rb,
lib/validators/disposable_domains.rb,
lib/validators/reserved_subdomains.rb
Defined Under Namespace
Modules: Ip, Version Classes: DisposableDomains, DisposableEmails, Hostname, ReservedSubdomains, TLD
Constant Summary collapse
- EMAIL_FORMAT =
/\A[a-z0-9]+([-._][a-z0-9]+)*(\+[^@]+)?@[a-z0-9]+([.-][a-z0-9]+)*\.[a-z]{2,}\z/i.freeze
- MICROSOFT_EMAIL_FORMAT =
/\A[a-z0-9][a-z0-9._-]*[a-z0-9_-]+(\+[a-z0-9]+)?@(hotmail|outlook).com\z/i.freeze
- IPV4_PART =
/\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]/.freeze
- URL_FORMAT =
%r[ \A https?:// # http:// or https:// ([^\s:@]+:[^\s:@]*@)? # optional username:pw@ ( (([^\W_]+\.)*xn--)?[^\W_]+([-.][^\W_]+)*\.[a-z]{2,6}\.? | # domain (including Punycode/IDN)... #{IPV4_PART}(\.#{IPV4_PART}){3} ) # or IPv4 (:\d{1,5})? # optional port ([/?]\S*)? # optional /whatever or ?whatever \z ]ixs.freeze
- URL_FORMAT_WITHOUT_TLD_VALIDATION =
%r[ \A https?:// # http:// or https:// ([^\s:@]+:[^\s:@]*@)? # optional username:pw@ ( (([^\W_]+\.)*xn--)?[^\W_]+([-.][^\W_]+)*\..{2,}\.? | # domain (including Punycode/IDN)... #{IPV4_PART}(\.#{IPV4_PART}){3} ) # or IPv4 (:\d{1,5})? # optional port ([/?]\S*)? # optional /whatever or ?whatever \z ]ixs.freeze
Class Method Summary collapse
Class Method Details
.require_dependency!(dep) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/validators.rb', line 29 def self.require_dependency!(dep) require dep rescue LoadError raise "#{dep} is not part of the bundle. " \ "Add it to your project's Gemfile." end |