Class: FamilySearch::Gedcomx::GraphPerson

Inherits:
Person show all
Defined in:
lib/familysearch/gedcomx/graph_person.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Person

#birth, #burial, #christening, #death, #full_name, #given_name, #name, #surname

Methods included from SuperCoercion

included

Constructor Details

#initialize(hash, graph = nil) ⇒ GraphPerson

Returns a new instance of GraphPerson.



7
8
9
10
# File 'lib/familysearch/gedcomx/graph_person.rb', line 7

def initialize(hash,graph = nil)
  super(hash)
  self.graph = graph
end

Instance Attribute Details

#graphObject

Returns the value of attribute graph.



6
7
8
# File 'lib/familysearch/gedcomx/graph_person.rb', line 6

def graph
  @graph
end

Instance Method Details

#all_parentsObject



34
35
36
# File 'lib/familysearch/gedcomx/graph_person.rb', line 34

def all_parents
  @all_parents ||= get_all_parents
end

#fatherObject



26
27
28
# File 'lib/familysearch/gedcomx/graph_person.rb', line 26

def father
  self.graph.person(father_id)
end

#father_idObject



12
13
14
15
16
17
# File 'lib/familysearch/gedcomx/graph_person.rb', line 12

def father_id
  child_of = self.graph.childAndParentsRelationships.find{|cpr|cpr.child.resourceId == self.id}
  if child_of && child_of.father
    child_of.father.resourceId
  end
end

#motherObject



30
31
32
# File 'lib/familysearch/gedcomx/graph_person.rb', line 30

def mother
  self.graph.person(mother_id)
end

#mother_idObject



19
20
21
22
23
24
# File 'lib/familysearch/gedcomx/graph_person.rb', line 19

def mother_id
  child_of = self.graph.childAndParentsRelationships.find{|cpr|cpr.child.resourceId == self.id}
  if child_of && child_of.mother
    child_of.mother.resourceId
  end
end