class Pupa::ContactDetailList

A list of contact details.

Public Instance Methods

address() click to toggle source

Returns the first postal address within the list of contact details.

@return [String,nil] a postal address

# File lib/pupa/models/contact_detail_list.rb, line 7
def address
  find_by_type('address')
end
email() click to toggle source

Returns the first email address within the list of contact details.

@return [String,nil] an email address

# File lib/pupa/models/contact_detail_list.rb, line 14
def email
  find_by_type('email')
end
find_by_type(type) click to toggle source

Returns the value of the first contact detail matching the type.

@param [String] a type @return [String,nil] a value

# 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