class Pipl::Name
Attributes
@!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`.
@!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`.
@!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`.
@!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`.
@!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`.
@!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`.
@!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`.
@!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
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
# 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
# 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
# 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