lib/osm/member.rb in osm-1.2.18.dev.3 vs lib/osm/member.rb in osm-1.2.18.dev.4
- old
+ new
@@ -583,36 +583,41 @@
# @return [Array<String>]
def all_emails
[email_1, email_2].select{ |e| !e.blank? }
end
+ # Get an array of all emails for the contact in a format which includes their name
+ # @return [Array<String>]
+ def all_emails_with_name
+ [email_1, email_2].select{ |e| !e.blank? }.map{ |e| "\"#{name}\" <#{e}>" }
+ end
+
+ end
+
+ module EnableableEmailableContact
+ include EmailableContact
+
# Get an array of enabled emails for the contact
# @return [Array<String>]
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
- # Get an array of all emails for the contact in a format which includes their name
- # @return [Array<String>]
- def all_emails_with_name
- [email_1, email_2].select{ |e| !e.blank? }.map{ |e| "\"#{name}\" <#{e}>" }
- end
-
# Get an array of enabled emails for the contact in a format which includes their name
# @return [Array<String>]
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
end
- module PhoneableContact
+ module EnableablePhoneableContact
# Get an array of enabled phone numbers for the contact
def enabled_phones
phones = []
phones.push phone_1.gsub(/[^\d\+]/, '') if receive_phone_1
phones.push phone_2.gsub(/[^\d\+]/, '') if receive_phone_2
@@ -680,12 +685,12 @@
end
end
class MemberContact < Osm::Member::Contact
- include EmailableContact
- include PhoneableContact
+ include EnableableEmailableContact
+ include EnableablePhoneableContact
# @!attribute [rw] email_1
# @return [String] the primary email address for the member
# @!attribute [rw] email_2
# @return [String] the secondary email address for the member
# @!attribute [rw] receive_email_1
@@ -715,12 +720,12 @@
validates_inclusion_of :receive_phone_2, :in => [true, false]
end
class PrimaryContact < Osm::Member::Contact
- include EmailableContact
- include PhoneableContact
+ include EnableableEmailableContact
+ include EnableablePhoneableContact
# @!attribute [rw] email_1
# @return [String] the primary email address for the contact
# @!attribute [rw] email_2
# @return [String] the secondary email address for the contact
# @!attribute [rw] receive_email_1
@@ -750,9 +755,10 @@
validates_inclusion_of :receive_phone_2, :in => [true, false]
end # class PrimaryContact
class EmergencyContact < Osm::Member::Contact
+ include EmailableContact
# @!attribute [rw] email_1
# @return [String] the primary email address for the contact
# @!attribute [rw] email_2
# @return [String] the secondary email address for the contact