Class: LibTAD::OnThisDay::Person
- Inherits:
-
Object
- Object
- LibTAD::OnThisDay::Person
- Defined in:
- lib/types/onthisday/person.rb
Overview
A historical person.
Instance Attribute Summary collapse
-
#birthdate ⇒ ::LibTAD::TADTime::TADTime
readonly
Date of birth.
-
#categories ⇒ Array<String>
readonly
Person categories.
-
#deathdate ⇒ ::LibTAD::TADTime::TADTime
readonly
Date of death, if applicable.
-
#id ⇒ Integer
readonly
Identifier for the person.
-
#name ⇒ ::LibTAD::OnThisDay::Name
readonly
Full name.
-
#nationalities ⇒ Array<String>
readonly
The nationalities of the person.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Person
constructor
A new instance of Person.
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 |
#categories ⇒ Array<String> (readonly)
Person categories.
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 |
#id ⇒ Integer (readonly)
Identifier for the person.
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 |
#nationalities ⇒ Array<String> (readonly)
The nationalities of the person
27 28 29 |
# File 'lib/types/onthisday/person.rb', line 27 def nationalities @nationalities end |