Module: HMachine::Pattern::URL

Extended by:
HMachine
Defined in:
lib/hmachine/pattern/url.rb

Constant Summary

Constants included from HMachine

HMachine::PRODID, VERSION

Class Method Summary collapse

Methods included from HMachine

extract, extract_from, find, find_in, found_in?, get, get_document, get_url, map, parse, parse_first, search, valid?, validate

Class Method Details

.normalize(url) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/hmachine/pattern/url.rb', line 21

def self.normalize(url)
  uri = URI.parse(url).normalize.to_s
  if uri.index('mailto:').eql?(0)
    email = uri.split('mailto:')[1].split('?').first
  else
    uri
  end
end