class Yardi::Utils::PhoneParser
Public Class Methods
parse(phone)
click to toggle source
A single prospect/resident can have have 0 to many <Phone> nodes, so prospect/resident can have three different types:
nil if there's no phone included a Hash representing a single phone number if there's one phone an Array if there are multiple phones
@param phone [nil|Hash|Array] @return [Array<String>] if at least one `PhoneNumber` exists, or nil
otherwise.
# File lib/yardi/utils/phone_parser.rb, line 14 def self.parse(phone) if phone.is_a?(Array) phone.map { |ph| ph['PhoneNumber'] }.compact elsif phone && phone['PhoneNumber'] [phone['PhoneNumber']] end end