Class: MonkeyMailer::Email

Inherits:
Object
  • Object
show all
Defined in:
lib/monkey-mailer/email.rb

Defined Under Namespace

Classes: Attachment

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = nil) ⇒ Email

Returns a new instance of Email.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/monkey-mailer/email.rb', line 6

def initialize(hash=nil)
  self.attachments = []
  unless hash.nil?
    new_attachments = [hash.delete(:attachments)].flatten.compact
    new_attachments.each do |attachment_hash|
      self.attachments << Attachment.new(attachment_hash)
    end

    hash.each_pair{|key, value| self.send("#{key}=", value)}
  end
end

Instance Attribute Details

#attachmentsObject

Returns the value of attribute attachments.



4
5
6
# File 'lib/monkey-mailer/email.rb', line 4

def attachments
  @attachments
end

#bodyObject

Returns the value of attribute body.



4
5
6
# File 'lib/monkey-mailer/email.rb', line 4

def body
  @body
end

#from_emailObject

Returns the value of attribute from_email.



4
5
6
# File 'lib/monkey-mailer/email.rb', line 4

def from_email
  @from_email
end

#from_nameObject

Returns the value of attribute from_name.



4
5
6
# File 'lib/monkey-mailer/email.rb', line 4

def from_name
  @from_name
end

#priorityObject

Returns the value of attribute priority.



4
5
6
# File 'lib/monkey-mailer/email.rb', line 4

def priority
  @priority
end

#subjectObject

Returns the value of attribute subject.



4
5
6
# File 'lib/monkey-mailer/email.rb', line 4

def subject
  @subject
end

#to_emailObject

Returns the value of attribute to_email.



4
5
6
# File 'lib/monkey-mailer/email.rb', line 4

def to_email
  @to_email
end

#to_nameObject

Returns the value of attribute to_name.



4
5
6
# File 'lib/monkey-mailer/email.rb', line 4

def to_name
  @to_name
end