class Gedcomx::Relationship

Attributes

person1[R]
person2[R]

Public Class Methods

create(attributes = {}) click to toggle source
# File lib/gedcomx/relationship.rb, line 10
def self.create(attributes = {})
  new_relationship = self.new
  new_relationship.type = attributes[:type] if attributes[:type]
  new_relationship.person1 = attributes[:person1] if attributes[:person1]
  new_relationship.person2 = attributes[:person2] if attributes[:person2]
  new_relationship
end
java_class() click to toggle source
# File lib/gedcomx/relationship.rb, line 6
def self.java_class
  Java::OrgGedcomxConclusion::Relationship
end
new(input = nil) click to toggle source
# File lib/gedcomx/relationship.rb, line 18
def initialize(input = nil)
  @relationship = input || self.class.java_class.new
  @person1 = Gedcomx::ResourceReference.new(@relationship.get_person1) if @relationship.get_person1
  @person2 = Gedcomx::ResourceReference.new(@relationship.get_person2) if @relationship.get_person2
end

Public Instance Methods

couple?() click to toggle source
# File lib/gedcomx/relationship.rb, line 24
def couple?
  type == TYPES[:couple]
end
parent_child?() click to toggle source
# File lib/gedcomx/relationship.rb, line 28
def parent_child?
  type == TYPES[:parent_child]
end
person1=(person_reference) click to toggle source
# File lib/gedcomx/relationship.rb, line 32
def person1=(person_reference)
  return false unless person_reference.is_a? Gedcomx::ResourceReference
  @relationship.person1 = person_reference.to_java
  @person1 = person_reference
end
person2=(person_reference) click to toggle source
# File lib/gedcomx/relationship.rb, line 38
def person2=(person_reference)
  return false unless person_reference.is_a? Gedcomx::ResourceReference
  @relationship.person2 = person_reference.to_java
  @person2 = person_reference
end
to_java() click to toggle source
# File lib/gedcomx/relationship.rb, line 52
def to_java
  @relationship
end
type() click to toggle source
# File lib/gedcomx/relationship.rb, line 44
def type
  @relationship.get_type.to_s
end
type=(input_type) click to toggle source
# File lib/gedcomx/relationship.rb, line 48
def type=(input_type)
  @relationship.type = ( input_type.is_a? Gedcomx.java_uri_class ) ? input_type : Gedcomx.new_uri(input_type)
end