Sha256: fa64924be614836982340e4eb21e2e96d3726ef114457ee0aadf99420e5e3a46

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

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

    self.schema = 'popolo/person'

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

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

    # 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
      {
        '$or' => [
          {'name' => name},
          {'other_names.name' => name},
        ],
      }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pupa-0.0.13 lib/pupa/models/person.rb
pupa-0.0.12 lib/pupa/models/person.rb
pupa-0.0.11 lib/pupa/models/person.rb
pupa-0.0.10 lib/pupa/models/person.rb
pupa-0.0.9 lib/pupa/models/person.rb