Class: Maildis::Recipient

Inherits:
Object
  • Object
show all
Defined in:
lib/maildis/recipient.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, email, merge_fields = []) ⇒ Recipient

Returns a new instance of Recipient.



6
7
8
9
10
# File 'lib/maildis/recipient.rb', line 6

def initialize(name, email, merge_fields=[])
  @name = name
  @email = email
  @merge_fields = merge_fields
end

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



3
4
5
# File 'lib/maildis/recipient.rb', line 3

def email
  @email
end

#merge_fieldsObject

Returns the value of attribute merge_fields.



4
5
6
# File 'lib/maildis/recipient.rb', line 4

def merge_fields
  @merge_fields
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/maildis/recipient.rb', line 3

def name
  @name
end

Instance Method Details

#to_emailObject



12
13
14
15
# File 'lib/maildis/recipient.rb', line 12

def to_email
  return "#{@name} <#{@email}>" if @name
  @email
end

#to_sObject



17
18
19
# File 'lib/maildis/recipient.rb', line 17

def to_s
  "<Recipient #{name} | #{email}>"
end