Module: Turl::Normalizer

Extended by:
Normalizer
Included in:
Normalizer
Defined in:
lib/turl/normalizer.rb

Instance Method Summary collapse

Instance Method Details

#normalize(url) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/turl/normalizer.rb', line 5

def normalize(url)
  path = []
  normalize_internal(url, path: path).tap do |result|
    path.each do |before|
      record = UrlNormalization.find_or_initialize_by(original_url: before)
      record.update!(normalized_url: result)
    end
  end
end