Class: Remailer::SMTP::Server::Transaction

Inherits:
Object
  • Object
show all
Defined in:
lib/remailer/smtp/server/transaction.rb

Constant Summary collapse

ATTRIBUTES =

Constants ============================================================

[ :sender, :recipients, :data ].freeze

Instance Method Summary collapse

Constructor Details

#initialize(options = nil) ⇒ Transaction

Instance Methods =====================================================



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/remailer/smtp/server/transaction.rb', line 14

def initialize(options = nil)
  case (options)
  when Remailer::SMTP::Server::Transaction
    ATTRIBUTES.each do |attribute|
      instance_variable_set("@#{attribute}", options.send(attribute))
    end
  when Hash
    ATTRIBUTES.each do |attr|
      instance_variable_set("@#{attribute}", options[attribute])
    end
  end
  
  self.recipients = [ self.recipients ].compact.flatten
  self.data ||= ''
end