Module: RefererParser::Referers

Defined in:
lib/referer-parser/referers.rb

Class Method Summary collapse

Class Method Details

.get_referer(uri) ⇒ Object

Returns the referer indicated by the given ‘uri`



27
28
29
30
31
32
33
34
35
# File 'lib/referer-parser/referers.rb', line 27

def self.get_referer(uri)
  # Check if domain+path matches (e.g. google.co.uk/products)
  referer = @referers[uri.host + uri.path]
  if referer.nil?
    # Check if domain only matches (e.g. google.co.uk)
    referer = @referers[uri.host]
  end
  referer
end