class Gedcomx::NamePart

Attributes

fields[R]

Public Class Methods

create(attributes = {}) click to toggle source
# File lib/gedcomx/name_part.rb, line 10
def self.create(attributes = {})
  new_part = self.new
  new_part.value = attributes[:value] if attributes[:value]
  new_part.type = attributes[:type] if attributes[:type]
  attributes[:fields].each { |field| new_part.add_field field } if attributes[:fields].is_a? Array
  new_part
end
java_class() click to toggle source
# File lib/gedcomx/name_part.rb, line 6
def self.java_class
  Java::OrgGedcomxConclusion::NamePart
end
new(input = nil) click to toggle source
# File lib/gedcomx/name_part.rb, line 18
def initialize(input = nil)
  @name_part = input || self.class.java_class.new
  @fields = []
  @fields = @name_part.fields.map { |field| Gedcomx::Field.new(field) } if @name_part.fields
end

Public Instance Methods

add_field(field) click to toggle source
# File lib/gedcomx/name_part.rb, line 24
def add_field(field)
  return false unless field.is_a? Gedcomx::Field
  @name_part.to_java.add_field field.to_java
  @fields << field
end
to_java() click to toggle source
# File lib/gedcomx/name_part.rb, line 46
def to_java
  @name_part
end
type() click to toggle source
# File lib/gedcomx/name_part.rb, line 30
def type
  @name_part.get_type.to_s
end
type=(input_type) click to toggle source
# File lib/gedcomx/name_part.rb, line 34
def type=(input_type)
  @name_part.type = ( input_type.is_a? Gedcomx.java_uri_class ) ? input_type : Gedcomx.new_uri(input_type)
end
value() click to toggle source
# File lib/gedcomx/name_part.rb, line 38
def value
  @name_part.get_value
end
value=(input_value) click to toggle source
# File lib/gedcomx/name_part.rb, line 42
def value=(input_value)
  @name_part.value = input_value
end