Class: Gedcomx::Relationship
- Inherits:
-
Object
- Object
- Gedcomx::Relationship
- Defined in:
- lib/gedcomx/relationship.rb
Instance Attribute Summary collapse
-
#person1 ⇒ Object
Returns the value of attribute person1.
-
#person2 ⇒ Object
Returns the value of attribute person2.
Class Method Summary collapse
Instance Method Summary collapse
- #couple? ⇒ Boolean
-
#initialize(input = nil) ⇒ Relationship
constructor
A new instance of Relationship.
- #parent_child? ⇒ Boolean
- #to_java ⇒ Object
- #type ⇒ Object
- #type=(input_type) ⇒ Object
Constructor Details
#initialize(input = nil) ⇒ Relationship
Returns a new instance of Relationship.
18 19 20 21 22 |
# 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 |
Instance Attribute Details
#person1 ⇒ Object
Returns the value of attribute person1.
4 5 6 |
# File 'lib/gedcomx/relationship.rb', line 4 def person1 @person1 end |
#person2 ⇒ Object
Returns the value of attribute person2.
4 5 6 |
# File 'lib/gedcomx/relationship.rb', line 4 def person2 @person2 end |
Class Method Details
.create(attributes = {}) ⇒ Object
10 11 12 13 14 15 16 |
# 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 ⇒ Object
6 7 8 |
# File 'lib/gedcomx/relationship.rb', line 6 def self.java_class Java::OrgGedcomxConclusion::Relationship end |
Instance Method Details
#couple? ⇒ Boolean
24 25 26 |
# File 'lib/gedcomx/relationship.rb', line 24 def couple? type == TYPES[:couple] end |
#parent_child? ⇒ Boolean
28 29 30 |
# File 'lib/gedcomx/relationship.rb', line 28 def parent_child? type == TYPES[:parent_child] end |
#to_java ⇒ Object
52 53 54 |
# File 'lib/gedcomx/relationship.rb', line 52 def to_java @relationship end |
#type ⇒ Object
44 45 46 |
# File 'lib/gedcomx/relationship.rb', line 44 def type @relationship.get_type.to_s end |
#type=(input_type) ⇒ Object
48 49 50 |
# 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 |