Class: Pupa::ContactDetailList
- Inherits:
-
Array
- Object
- Array
- Pupa::ContactDetailList
- Defined in:
- lib/pupa/models/contact_detail_list.rb
Overview
A list of contact details.
Instance Method Summary collapse
-
#address ⇒ String?
Returns the first postal address within the list of contact details.
-
#email ⇒ String?
Returns the first email address within the list of contact details.
-
#find_by_type(type) ⇒ String?
Returns the value of the first contact detail matching the type.
Instance Method Details
#address ⇒ String?
Returns the first postal address within the list of contact details.
7 8 9 |
# File 'lib/pupa/models/contact_detail_list.rb', line 7 def address find_by_type('address') end |
#email ⇒ String?
Returns the first email address within the list of contact details.
14 15 16 |
# File 'lib/pupa/models/contact_detail_list.rb', line 14 def email find_by_type('email') end |
#find_by_type(type) ⇒ String?
Returns the value of the first contact detail matching the type.
22 23 24 25 26 27 28 |
# File 'lib/pupa/models/contact_detail_list.rb', line 22 def find_by_type(type) find{|contact_detail| contact_detail[:type] == type }.try{|contact_detail| contact_detail[:value] } end |