class Pipl::Name

Attributes

display[RW]

@!attribute first

@return [String] First name

@!attribute middle

@return [String] Middle name or initial

@!attribute last

@return [String] Last name

@!attribute prefix

@return [String] Name prefix

@!attribute suffix

@return [String] Name suffix

@!attribute type

@return [String] Type of association of this name to a person. One of `present`, `maiden`, `former` or `alias`.
first[RW]

@!attribute first

@return [String] First name

@!attribute middle

@return [String] Middle name or initial

@!attribute last

@return [String] Last name

@!attribute prefix

@return [String] Name prefix

@!attribute suffix

@return [String] Name suffix

@!attribute type

@return [String] Type of association of this name to a person. One of `present`, `maiden`, `former` or `alias`.
last[RW]

@!attribute first

@return [String] First name

@!attribute middle

@return [String] Middle name or initial

@!attribute last

@return [String] Last name

@!attribute prefix

@return [String] Name prefix

@!attribute suffix

@return [String] Name suffix

@!attribute type

@return [String] Type of association of this name to a person. One of `present`, `maiden`, `former` or `alias`.
middle[RW]

@!attribute first

@return [String] First name

@!attribute middle

@return [String] Middle name or initial

@!attribute last

@return [String] Last name

@!attribute prefix

@return [String] Name prefix

@!attribute suffix

@return [String] Name suffix

@!attribute type

@return [String] Type of association of this name to a person. One of `present`, `maiden`, `former` or `alias`.
prefix[RW]

@!attribute first

@return [String] First name

@!attribute middle

@return [String] Middle name or initial

@!attribute last

@return [String] Last name

@!attribute prefix

@return [String] Name prefix

@!attribute suffix

@return [String] Name suffix

@!attribute type

@return [String] Type of association of this name to a person. One of `present`, `maiden`, `former` or `alias`.
raw[RW]

@!attribute first

@return [String] First name

@!attribute middle

@return [String] Middle name or initial

@!attribute last

@return [String] Last name

@!attribute prefix

@return [String] Name prefix

@!attribute suffix

@return [String] Name suffix

@!attribute type

@return [String] Type of association of this name to a person. One of `present`, `maiden`, `former` or `alias`.
suffix[RW]

@!attribute first

@return [String] First name

@!attribute middle

@return [String] Middle name or initial

@!attribute last

@return [String] Last name

@!attribute prefix

@return [String] Name prefix

@!attribute suffix

@return [String] Name suffix

@!attribute type

@return [String] Type of association of this name to a person. One of `present`, `maiden`, `former` or `alias`.
type[RW]

@!attribute first

@return [String] First name

@!attribute middle

@return [String] Middle name or initial

@!attribute last

@return [String] Last name

@!attribute prefix

@return [String] Name prefix

@!attribute suffix

@return [String] Name suffix

@!attribute type

@return [String] Type of association of this name to a person. One of `present`, `maiden`, `former` or `alias`.

Public Class Methods

new(params={}) click to toggle source
Calls superclass method Pipl::Field::new
# File lib/pipl/fields.rb, line 72
def initialize(params={})
  super params
  @first = params[:first]
  @middle = params[:middle]
  @last = params[:last]
  @prefix = params[:prefix]
  @suffix = params[:suffix]
  @type = params[:type]
  @raw = params[:raw]
  @display = params[:display]
end

Public Instance Methods

is_searchable?() click to toggle source
# File lib/pipl/fields.rb, line 89
def is_searchable?
  first = Pipl::Utils.alpha_chars(@first || '')
  last = Pipl::Utils.alpha_chars(@last || '')
  raw = Pipl::Utils.alpha_chars(@raw || '')
  (first.length > 1 and last.length > 1) or raw.length > 3
end
to_hash() click to toggle source
# File lib/pipl/fields.rb, line 84
def to_hash
  {first: @first, middle: @middle, last: @last, prefix: @prefix, suffix: @suffix, raw: @raw}
      .reject { |_, value| value.nil? }
end
to_s() click to toggle source
# File lib/pipl/fields.rb, line 96
def to_s
  return @display if @display

  vals = [@prefix, @first, @middle, @last, @suffix]
  s = vals.any? ? vals.select { |v| v }.map { |v| v.capitalize }.join(' ') : nil
  s ? Pipl::Utils.to_utf8(s) : ''
end