Class: ESearchy::GenericEngine
- Inherits:
-
Object
- Object
- ESearchy::GenericEngine
- Defined in:
- lib/esearchy/genericengine.rb
Direct Known Subclasses
OtherEngines::AmazonWishList, OtherEngines::GoogleGroups, OtherEngines::PGP, OtherEngines::Spider, OtherEngines::Usenet, SearchEngines::Altavista, SearchEngines::Bing, SearchEngines::Google, SearchEngines::Yahoo, SocialEngines::Classmates, SocialEngines::GooglePlus, SocialEngines::GoogleProfiles, SocialEngines::JigSaw, SocialEngines::LinkedIn, SocialEngines::Naymz, SocialEngines::Plaxo, SocialEngines::Spoke, SocialEngines::Ziggs
Instance Attribute Summary collapse
-
#documents ⇒ Object
readonly
Returns the value of attribute documents.
-
#emails ⇒ Object
readonly
Returns the value of attribute emails.
-
#people ⇒ Object
readonly
Returns the value of attribute people.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
- #company=(v) ⇒ Object
-
#initialize(query, start = 0, stop = nil, &block) ⇒ GenericEngine
constructor
A new instance of GenericEngine.
- #maxhits=(v) ⇒ Object
- #search ⇒ Object
- #start=(v) ⇒ Object
Constructor Details
#initialize(query, start = 0, stop = nil, &block) ⇒ GenericEngine
Returns a new instance of GenericEngine.
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/esearchy/genericengine.rb', line 4 def initialize(query, start = 0, stop = nil, &block) @query = CGI.escape(query) or raise ESearchyMissingQuery @company = ESearchy::Search.company || "" @start = start @totalhits = stop @documents = [] self.class::TYPE < 2 ? @emails = [] : @people = [] @results = [] block.call(self) if block_given? end |
Instance Attribute Details
#documents ⇒ Object (readonly)
Returns the value of attribute documents.
15 16 17 |
# File 'lib/esearchy/genericengine.rb', line 15 def documents @documents end |
#emails ⇒ Object (readonly)
Returns the value of attribute emails.
17 18 19 |
# File 'lib/esearchy/genericengine.rb', line 17 def emails @emails end |
#people ⇒ Object (readonly)
Returns the value of attribute people.
18 19 20 |
# File 'lib/esearchy/genericengine.rb', line 18 def people @people end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
16 17 18 |
# File 'lib/esearchy/genericengine.rb', line 16 def results @results end |
Instance Method Details
#company=(v) ⇒ Object
40 41 42 |
# File 'lib/esearchy/genericengine.rb', line 40 def company=(v) @company=v end |
#maxhits=(v) ⇒ Object
36 37 38 |
# File 'lib/esearchy/genericengine.rb', line 36 def maxhits=(v) @totalhits=v end |
#search ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/esearchy/genericengine.rb', line 21 def search get self.class::ENGINE, self.class::PORT, @querypath + @start.to_s, header() do |r| parse(r.body) D "Searching #{self.class} from #{@start} to #{calculate_top()}.\n" crawler(r.body.gsub(/<em>|<\/em>/,"").gsub(/<b>|<\/b>/,"")) unless @totalhits == 0 @start = @start + self.class::NUM sleep(4) and search if @totalhits > @start end end |
#start=(v) ⇒ Object
32 33 34 |
# File 'lib/esearchy/genericengine.rb', line 32 def start=(v) @start=v end |