Class: LibTAD::OnThisDay::Person

Inherits:
Object
  • Object
show all
Defined in:
lib/types/onthisday/person.rb

Overview

A historical person.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Person

Returns a new instance of Person.



29
30
31
32
33
34
35
36
# File 'lib/types/onthisday/person.rb', line 29

def initialize(hash)
  @id = hash.fetch('id', nil)
  @name = ::LibTAD::OnThisDay::Name.new hash.fetch('name', nil)
  @birthdate = ::LibTAD::TADTime::TADTime.new hash['birthdate'] unless !hash.key?('birthdate')
  @deathdate = ::LibTAD::TADTime::TADTime.new hash['deathdate'] unless !hash.key?('deathdate')
  @categories = hash.fetch('categories', nil)
  @nationalities = hash.fetch('nationalities', nil)
end

Instance Attribute Details

#birthdate::LibTAD::TADTime::TADTime (readonly)

Date of birth.



15
16
17
# File 'lib/types/onthisday/person.rb', line 15

def birthdate
  @birthdate
end

#categoriesArray<String> (readonly)

Person categories.

Returns:

  • (Array<String>)


23
24
25
# File 'lib/types/onthisday/person.rb', line 23

def categories
  @categories
end

#deathdate::LibTAD::TADTime::TADTime (readonly)

Date of death, if applicable.



19
20
21
# File 'lib/types/onthisday/person.rb', line 19

def deathdate
  @deathdate
end

#idInteger (readonly)

Identifier for the person.

Returns:

  • (Integer)


7
8
9
# File 'lib/types/onthisday/person.rb', line 7

def id
  @id
end

#name::LibTAD::OnThisDay::Name (readonly)

Full name.



11
12
13
# File 'lib/types/onthisday/person.rb', line 11

def name
  @name
end

#nationalitiesArray<String> (readonly)

The nationalities of the person

Returns:

  • (Array<String>)


27
28
29
# File 'lib/types/onthisday/person.rb', line 27

def nationalities
  @nationalities
end