Class: SearchEngine

Inherits:
Object
  • Object
show all
Defined in:
lib/visitor_sources/search_engine.rb

Constant Summary collapse

SEARCH_ENGINES =
{
"google" => "q",
"yahoo" => "p",
"msn" => "q",
"aol" => "query",
"aol" => "encquery",
"lycos" => "query",
"ask" => "q",
"altavista" => "q",
"netscape" => "query",
"cnn" => "query",
"looksmart" => "qt",
"about" => "terms",
"mamma" => "query",
"alltheweb" => "q",
"gigablast" => "q",
"voila" => "rdata",
"virgilio" => "qs",
"live" => "q",
"baidu" => "wd",
"alice" => "qs",
"yandex" => "text",
"najdi" => "q",
"aol" => "q",
"club-internet" => "query",
"mama" => "query",
"seznam" => "q",
"search" => "q",
"wp" => "szukaj",
"onet" => "qt",
"netsprint" => "q",
"google.interia" => "q",
"szukacz" => "q",
"yam" => "k",
"pchome" => "q",
"kvasir" => "searchExpr",
"sesam" => "q",
"ozu" => "q",
"terra" => "query",
"nostrum" => "query",
"mynet" => "q",
"ekolay" => "q",
"search.ilse" => "search_for"}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name.



46
47
48
# File 'lib/visitor_sources/search_engine.rb', line 46

def name
  @name
end

#search_parameterObject

Returns the value of attribute search_parameter.



46
47
48
# File 'lib/visitor_sources/search_engine.rb', line 46

def search_parameter
  @search_parameter
end

Class Method Details

.find(domain) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/visitor_sources/search_engine.rb', line 48

def self.find(domain)
  SEARCH_ENGINES.each do |name, search_parameter|
    if domain =~ /#{name}/
      engine =  SearchEngine.new
      engine.name = name
      engine.search_parameter = search_parameter
      return engine
    end
  end
  return nil
end