Class: ESearchy::Search::People

Inherits:
Object
  • Object
show all
Includes:
MetaType
Defined in:
lib/esearchy/esearchy.rb

Instance Method Summary collapse

Methods included from MetaType

#[], #docs, #maxhits=, #method_missing, #results

Constructor Details

#initialize(*args, &block) ⇒ People

Returns a new instance of People.



172
173
174
175
176
177
178
179
# File 'lib/esearchy/esearchy.rb', line 172

def initialize(*args, &block)
  @engines={}
  (args[0].instance_of?(Array) ? args[0] : args).each do |e|
    @engines[e] = ESearchy::Search::PEOPLE_ENGINES[e].new(Search.company)
  end
  self.maxhits=Search.maxhits if Search.maxhits
  block.call(self) if block_given?
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ESearchy::Search::MetaType

Instance Method Details

#peopleObject



181
182
183
# File 'lib/esearchy/esearchy.rb', line 181

def people
  $people
end

#search(&block) ⇒ Object



185
186
187
188
189
190
191
192
193
# File 'lib/esearchy/esearchy.rb', line 185

def search(&block)
  @engines.each_key do |e| 
    @engines[e].search
    save_people(e)
    save_results(e)
    block.call(self) if block_given?
  end
  nil
end