Sha256: eb091731645ff790fb017d6da5b2f1ef2ebda79ffff053df58b8bcf965690115
Contents?: true
Size: 310 Bytes
Versions: 2
Compression:
Stored size: 310 Bytes
Contents
# frozen_string_literal: true module ValidatesHost class DomainName def initialize(domain_name) @domain_name = domain_name end def valid? return true if @domain_name.blank? @domain_name =~ %r{^[a-z0-9]+([\-.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(/.*)?$} end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
validates_host-1.3.0 | lib/validates_host/domain_name.rb |
validates_host-1.2.0 | lib/validates_host/domain_name.rb |