Class: Puree::Model::PersonName

Inherits:
Structure show all
Defined in:
lib/puree/model/person_name.rb

Overview

The name of a person.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Structure

#data?

Instance Attribute Details

#firstString?

Returns:

  • (String, nil)


9
10
11
# File 'lib/puree/model/person_name.rb', line 9

def first
  @first
end

#lastString?

Returns:

  • (String, nil)


12
13
14
# File 'lib/puree/model/person_name.rb', line 12

def last
  @last
end

Instance Method Details

#first_lastString

Returns:

  • (String)


25
26
27
# File 'lib/puree/model/person_name.rb', line 25

def first_last
  both? ? "#{first} #{last}" : 'One or both names missing'
end

#initial_lastString

Returns:

  • (String)


35
36
37
# File 'lib/puree/model/person_name.rb', line 35

def initial_last
  both? ? "#{first[0, 1]}. #{last}" : 'One or both names missing'
end

#last_firstString

Returns:

  • (String)


30
31
32
# File 'lib/puree/model/person_name.rb', line 30

def last_first
  both? ? "#{last}, #{first}" : 'One or both names missing'
end

#last_initialString

Returns:

  • (String)


40
41
42
# File 'lib/puree/model/person_name.rb', line 40

def last_initial
  both? ? "#{last}, #{first[0, 1]}." : 'One or both names missing'
end