class Gedcomx::Name
Attributes
date[R]
forms[R]
Public Class Methods
build_simple(attributes = {})
click to toggle source
# File lib/gedcomx/name.rb, line 10 def self.build_simple(attributes = {}) first = attributes[:first] last = attributes[:last] name_form = Gedcomx::NameForm.new name_form.full_text = attributes[:full] if attributes[:full] if first field = Gedcomx::Field.create( first_attributes = { values: [ { text: first, type: Gedcomx::TYPES[:original] } ], type: Gedcomx::TYPES[:given] } ) name_part = Gedcomx::NamePart.create( first_attributes = { fields: [ field ], value: first, type: Gedcomx::TYPES[:given] }) name_form.add_part(name_part) end if last field = Gedcomx::Field.create( last_attributes = { values: [ { text: last, type: Gedcomx::TYPES[:original] } ], type: Gedcomx::TYPES[:surname] } ) name_part = Gedcomx::NamePart.create( last_attributes = { fields: [ field ], value: last, type: Gedcomx::TYPES[:surname] }) name_form.add_part(name_part) end attributes[:forms] = [name_form] self.create(attributes) end
create(attributes = {})
click to toggle source
# File lib/gedcomx/name.rb, line 50 def self.create(attributes = {}) new_name = self.new new_name.confidence = attributes[:confidence] if attributes[:confidence] new_name.preferred = attributes[:preferred] if attributes[:preferred] new_name.language = attributes[:language] if attributes[:language] new_name.type = attributes[:type] if attributes[:type] if attributes[:type] puts attributes[:type] end attributes[:forms].each { |form| new_name.add_form(form) } if attributes[:forms].is_a? Array new_name end
java_class()
click to toggle source
# File lib/gedcomx/name.rb, line 6 def self.java_class Java::OrgGedcomxConclusion::Name end
new(input = nil)
click to toggle source
# File lib/gedcomx/name.rb, line 65 def initialize(input = nil) @name = input || self.class.java_class.new @date = Gedcomx::Date.new(@name.get_date) if @name.get_date @forms = [] @forms = @name.get_name_forms.map { |form| Gedcomx::NameForm.new(form) } if @name.get_name_forms end
Public Instance Methods
add_form(form)
click to toggle source
# File lib/gedcomx/name.rb, line 72 def add_form(form) return false unless form.is_a? Gedcomx::NameForm @name.add_name_form form.to_java @forms << form end
confidence()
click to toggle source
# File lib/gedcomx/name.rb, line 84 def confidence @name.get_confidence end
confidence=(input_confidence)
click to toggle source
# File lib/gedcomx/name.rb, line 88 def confidence=(input_confidence) if input_confidence.is_a? Gedcomx.java_uri_class @name.confidence = input_confidence else @name.confidence = Gedcomx.new_uri(input_confidence) end end
date=(date)
click to toggle source
# File lib/gedcomx/name.rb, line 78 def date=(date) return false unless date.is_a? Gedcomx::Date @name.date = date.to_java @date = date end
language()
click to toggle source
# File lib/gedcomx/name.rb, line 105 def language @name.get_lang end
language=(input_language)
click to toggle source
# File lib/gedcomx/name.rb, line 109 def language=(input_language) return false unless input_language.is_a? String @name.lang = input_language end
preferred=(input_boolean)
click to toggle source
# File lib/gedcomx/name.rb, line 100 def preferred=(input_boolean) return false unless input_boolean.is_a? Boolean @name.preferred = input_boolean end
preferred?()
click to toggle source
# File lib/gedcomx/name.rb, line 96 def preferred? @name.get_preferred end
to_java()
click to toggle source
# File lib/gedcomx/name.rb, line 122 def to_java @name end
type()
click to toggle source
# File lib/gedcomx/name.rb, line 114 def type @name.get_type.to_s end
type=(input_type)
click to toggle source
# File lib/gedcomx/name.rb, line 118 def type=(input_type) @name.type = ( input_type.is_a? Gedcomx.java_uri_class ) ? input_type : Gedcomx.new_uri(input_type) end