Sha256: e5123e183adc5c61e3e877d91d00e9218ae569605a13d4e9838176c5b1d09bba
Contents?: true
Size: 1.21 KB
Versions: 5
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
5 entries across 5 versions & 1 rubygems