Sha256: 71ea3d0f6d69787d4090b9ecd85e024c5e7cb6a718c751d02e104fbe0a01cdf5

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

module Pupa
  # A real person, alive or dead.
  class Person
    include Model

    self.schema = File.expand_path(File.join('..', '..', '..', 'schemas', 'popolo', 'person.json'), __dir__)

    include Concerns::Timestamps
    include Concerns::Sourceable
    include Concerns::Nameable
    include Concerns::Identifiable
    include Concerns::Contactable
    include Concerns::Linkable

    attr_accessor :name, :email, :gender, :birth_date, :death_date, :image, :summary, :biography, :national_identity,
      :family_name, :given_name, :additional_name, :honorific_prefix, :honorific_suffix, :patronymic_name, :sort_name
    dump          :name, :email, :gender, :birth_date, :death_date, :image, :summary, :biography, :national_identity,
      :family_name, :given_name, :additional_name, :honorific_prefix, :honorific_suffix, :patronymic_name, :sort_name

    # Returns the person's name.
    #
    # @return [String] the person's name
    def to_s
      name
    end

    # @todo This will obviously need to be scoped as in Python Pupa, to a
    #  jurisdiction, post, etc.
    def fingerprint
      if name
        {
          '$or' => [
            {'name' => name},
            {'other_names.name' => name},
          ],
        }
      else
        {}
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pupa-0.2.4 lib/pupa/models/person.rb