Sha256: 12ae3fb42215e94b8eb73fb70596a23c7c8073b4cc8ad208657f8c41a0538b8e
Contents?: true
Size: 1.21 KB
Versions: 9
Compression:
Stored size: 1.21 KB
Contents
module Roqua module Healthy module A19 class NameParser attr_reader :message def initialize(message) @message = message end def firstname return unless names[:nick] names[:nick].fetch('PID.5.2') end def initials "#{names[:legal].fetch('PID.5.2')} #{names[:legal].fetch('PID.5.3')}".strip end def lastname prefix = names[:legal].fetch('PID.5.1').fetch('PID.5.1.2') lastname = names[:legal].fetch('PID.5.1').fetch('PID.5.1.3') "#{prefix} #{lastname}".strip end def display_name return unless names[:display] names[:display].fetch('PID.5.1') end private def names names = {} message.fetch('PID').fetch('PID.5').each do |record| case record.fetch('PID.5.7', :unknown_type_of_name_record) when 'L' names[:legal] = record when 'D' names[:display] = record when 'N' names[:nick] = record else # ignore record end end names end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems