Class: Roqua::Healthy::A19::NameParser

Inherits:
Object
  • Object
show all
Defined in:
lib/roqua/healthy/a19/name_parser.rb

Direct Known Subclasses

CdisNameParser, EpicNameParser, ImpulseNameParser

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ NameParser

Returns a new instance of NameParser.



8
9
10
# File 'lib/roqua/healthy/a19/name_parser.rb', line 8

def initialize(message)
  @message = message
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



6
7
8
# File 'lib/roqua/healthy/a19/name_parser.rb', line 6

def message
  @message
end

Instance Method Details

#display_nameObject



27
28
29
30
# File 'lib/roqua/healthy/a19/name_parser.rb', line 27

def display_name
  return unless names[:display]
  names[:display].fetch('PID.5.1')
end

#firstnameObject



12
13
14
15
# File 'lib/roqua/healthy/a19/name_parser.rb', line 12

def firstname
  return unless names[:nick]
  names[:nick].fetch('PID.5.2')
end

#initialsObject



17
18
19
# File 'lib/roqua/healthy/a19/name_parser.rb', line 17

def initials
  "#{names[:legal].fetch('PID.5.2')} #{names[:legal].fetch('PID.5.3')}".strip
end

#lastnameObject



21
22
23
24
25
# File 'lib/roqua/healthy/a19/name_parser.rb', line 21

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

#nicknameObject



32
33
34
# File 'lib/roqua/healthy/a19/name_parser.rb', line 32

def nickname
  firstname
end