class FamilySearch::Gedcomx::GraphPerson

Attributes

graph[RW]

Public Class Methods

new(hash,graph = nil) click to toggle source
Calls superclass method
# File lib/familysearch/gedcomx/graph_person.rb, line 7
def initialize(hash,graph = nil)
  super(hash)
  self.graph = graph
end

Public Instance Methods

all_parents() click to toggle source
# File lib/familysearch/gedcomx/graph_person.rb, line 34
def all_parents
  @all_parents ||= get_all_parents
end
father() click to toggle source
# File lib/familysearch/gedcomx/graph_person.rb, line 26
def father
  self.graph.person(father_id)
end
father_id() click to toggle source
# 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
mother() click to toggle source
# File lib/familysearch/gedcomx/graph_person.rb, line 30
def mother
  self.graph.person(mother_id)
end
mother_id() click to toggle source
# 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

Private Instance Methods

get_all_parents() click to toggle source
# File lib/familysearch/gedcomx/graph_person.rb, line 40
def get_all_parents
  caprs = self.graph.childAndParentsRelationships.select{|cpr|cpr.child.resourceId == self.id}
  all_parents = caprs.collect do |capr|
    GraphParents.new(capr,self.graph)
  end
  all_parents
end