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

Returns a new instance of Emails.



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

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.



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

def emails
  @emails
end

Instance Method Details

#search(&block) ⇒ Object



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

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