Class: FastMailer::Mailer
- Inherits:
-
Object
- Object
- FastMailer::Mailer
- Defined in:
- lib/fast-mailer/mailer.rb
Instance Method Summary collapse
-
#initialize(options = nil) ⇒ Mailer
constructor
A new instance of Mailer.
- #send_all(mail_generator) ⇒ Object
Constructor Details
#initialize(options = nil) ⇒ Mailer
Returns a new instance of Mailer.
4 5 6 |
# File 'lib/fast-mailer/mailer.rb', line 4 def initialize( = nil) @options = end |
Instance Method Details
#send_all(mail_generator) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fast-mailer/mailer.rb', line 8 def send_all(mail_generator) @mail_generator = mail_generator @mutex = Mutex.new tcount = (@options && @options[:max_connections]) || 1 threads = [] if tcount > 1 tcount.times do |n| threads << Thread.new(n) do |tid| send_until_done end end threads.each { |thr| thr.join } else send_until_done end end |