Class: ESearchy::Search::Emails

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MetaType

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

Constructor Details

#initialize(*args, &block) ⇒ Emails



141
142
143
144
145
146
147
148
149
# File 'lib/esearchy/esearchy.rb', line 141

def initialize(*args, &block)
  @engines={}
  @documents = []
  (args[0].instance_of?(Array) ? args[0] : args).each do |e|
    @engines[e] = ESearchy::Search::EMAIL_ENGINES[e].new(Search.query)
  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 Attribute Details

#emailsObject (readonly)

Returns the value of attribute emails.



150
151
152
# File 'lib/esearchy/esearchy.rb', line 150

def emails
  @emails
end

Instance Method Details

#search(&block) ⇒ Object



152
153
154
155
156
157
158
159
160
# File 'lib/esearchy/esearchy.rb', line 152

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