class Gedcomx::Fact

Attributes

date[R]
fields[R]
place[R]

Public Class Methods

create(attributes = {}) click to toggle source
# File lib/gedcomx/fact.rb, line 10
def self.create(attributes = {})
  new_fact = self.new
  new_fact.date = attributes[:date] if attributes[:date]
  new_fact.type = attributes[:type] if attributes[:type]
  new_fact.value = attributes[:value] if attributes[:value]
  new_fact.primary = attributes[:primary] if attributes[:primary]
  attributes[:fields].each { |field| new_fact.add_field(field) } if attributes[:fields].is_a? Array
  new_fact
end
java_class() click to toggle source
# File lib/gedcomx/fact.rb, line 6
def self.java_class
  Java::OrgGedcomxConclusion::Fact
end
new(input = nil) click to toggle source
# File lib/gedcomx/fact.rb, line 20
def initialize(input = nil)
  @fact = input || self.class.java_class.new
  @date = Gedcomx::Date.new(@fact.get_date) if @fact.get_date
  @place = Gedcomx::Place.new(@fact.get_place) if @fact.get_place
  @fields = []
  @fields = @fact.fields.map { |field| Gedcomx::Field.new(field) } if @fact.fields.is_a? Array
end

Public Instance Methods

add_field(field) click to toggle source
# File lib/gedcomx/fact.rb, line 28
def add_field(field)
  return false unless field.is_a? Gedcomx::Field
  @fact.add_field field.to_java
  @fact.fields << field
end
date=(date) click to toggle source
# File lib/gedcomx/fact.rb, line 34
def date=(date)
  return false unless date.is_a? Gedcomx::Date
  @fact.date = date.to_java
  @date = date
end
primary=(is_primary) click to toggle source
# File lib/gedcomx/fact.rb, line 44
def primary=(is_primary)
  return false unless is_primary.is_a? Boolean
  @fact.primary = is_primary
end
primary?() click to toggle source
# File lib/gedcomx/fact.rb, line 40
def primary?
  @fact.get_primary
end
to_java() click to toggle source
# File lib/gedcomx/fact.rb, line 65
def to_java
  @fact
end
type() click to toggle source
# File lib/gedcomx/fact.rb, line 49
def type
  @fact.get_type.to_s
end
type=(input_type) click to toggle source
# File lib/gedcomx/fact.rb, line 53
def type= (input_type)
  @fact.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/fact.rb, line 57
def value
  @fact.get_value
end
value=(value_string) click to toggle source
# File lib/gedcomx/fact.rb, line 61
def value= (value_string)
  @fact.value = value_string
end