class Puree::Model::PersonName

The name of a person.

Attributes

first[R]

@return [String, nil]

last[R]

@return [String, nil]

Public Instance Methods

first=(v) click to toggle source

@param v [String]

# File lib/puree/model/person_name.rb, line 15
def first=(v)
  @first = v if v && !v.empty?
end
first_last() click to toggle source

@return [String]

# File lib/puree/model/person_name.rb, line 25
def first_last
  both? ? "#{first} #{last}" : 'One or both names missing'
end
initial_last() click to toggle source

@return [String]

# File lib/puree/model/person_name.rb, line 35
def initial_last
  both? ? "#{first[0, 1]}. #{last}" : 'One or both names missing'
end
last=(v) click to toggle source

@param v [String]

# File lib/puree/model/person_name.rb, line 20
def last=(v)
  @last = v if v && !v.empty?
end
last_first() click to toggle source

@return [String]

# File lib/puree/model/person_name.rb, line 30
def last_first
  both? ? "#{last}, #{first}" : 'One or both names missing'
end
last_initial() click to toggle source

@return [String]

# File lib/puree/model/person_name.rb, line 40
def last_initial
  both? ? "#{last}, #{first[0, 1]}." : 'One or both names missing'
end

Private Instance Methods

both?() click to toggle source
# File lib/puree/model/person_name.rb, line 46
def both?
  !@first.nil? && !@last.nil? || false
end