class HostParser
Constants
- HOST_VALIDITY_REGEX
Public Class Methods
new(host)
click to toggle source
# File lib/creative_rails_utilities/host_parser.rb, line 5 def initialize(host) @host = host end
Public Instance Methods
domain()
click to toggle source
# File lib/creative_rails_utilities/host_parser.rb, line 9 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