Module: Osm::Member::EnableableEmailableContact

Includes:
EmailableContact
Included in:
MemberContact, PrimaryContact
Defined in:
lib/osm/member.rb

Instance Method Summary collapse

Methods included from EmailableContact

#all_emails, #all_emails_with_name

Instance Method Details

#enabled_emailsArray<String>

Get an array of enabled emails for the contact

Returns:

  • (Array<String>)

586
587
588
589
590
591
# File 'lib/osm/member.rb', line 586

def enabled_emails
  emails = []
  emails.push email_1 if receive_email_1
  emails.push email_2 if receive_email_2
  emails.select{ |e| !e.blank? }
end

#enabled_emails_with_nameArray<String>

Get an array of enabled emails for the contact in a format which includes their name

Returns:

  • (Array<String>)

595
596
597
598
599
600
# File 'lib/osm/member.rb', line 595

def enabled_emails_with_name
  emails = []
  emails.push email_1 if receive_email_1
  emails.push email_2 if receive_email_2
  emails.select{ |e| !e.blank? }.map{ |e| "\"#{name}\" <#{e}>" }
end