Sha256: 0c2fb592898537eb9eecff0f1fd4357f1ed9f000e77e1c895ba4d3526b1a54db

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 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
      if name
        {
          '$or' => [
            {'name' => name},
            {'other_names.name' => name},
          ],
        }
      else
        {}
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pupa-0.1.7 lib/pupa/models/person.rb
pupa-0.1.6 lib/pupa/models/person.rb
pupa-0.1.5 lib/pupa/models/person.rb
pupa-0.1.4 lib/pupa/models/person.rb
pupa-0.1.3 lib/pupa/models/person.rb
pupa-0.1.2 lib/pupa/models/person.rb
pupa-0.1.1 lib/pupa/models/person.rb
pupa-0.1.0 lib/pupa/models/person.rb