Sha256: 493466fabd9d173d2ab78480655d54db3f395eaf3d7b5e4ef90361fd272c827f
Contents?: true
Size: 378 Bytes
Versions: 2
Compression:
Stored size: 378 Bytes
Contents
class HostParser self::HOST_VALIDITY_REGEX = %r'\A(?<subdomains>(?:\w+\.)*?)(?<domain>\w+\.\w{2,5})\z'.freeze def initialize(host) @host = host end def domain @host[send(:class)::HOST_VALIDITY_REGEX] return nil if $~.blank? match_hash = $~.names.inject({}){|mem, capture| mem[capture] = $~[capture]; mem} return match_hash["domain"] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
creative_rails_utilities-0.4.8 | lib/creative_rails_utilities/host_parser.rb |
creative_rails_utilities-0.4.7 | lib/creative_rails_utilities/host_parser.rb |