module Gedcomx

Constants

LOCATION_MAP
MONTH_MAP
TYPES

Public Class Methods

get_facts(obj, type) click to toggle source
# File lib/gedcomx.rb, line 131
def self.get_facts(obj, type)
  return unless obj
  obj.facts.select{|fact| fact.get_type.to_s == TYPES[type] }
end
get_fields(obj, type) click to toggle source
# File lib/gedcomx.rb, line 141
def self.get_fields(obj, type)
  return unless obj
  obj.fields.select{|field| field.get_type.to_s == TYPES[type] }
end
get_first_fact(obj, type) click to toggle source
# File lib/gedcomx.rb, line 136
def self.get_first_fact(obj, type)
  return unless obj
  obj.facts.find{|fact| fact.get_type.to_s == TYPES[type] }
end
get_first_field(obj, type) click to toggle source
# File lib/gedcomx.rb, line 146
def self.get_first_field(obj, type)
  return unless obj
  obj.fields.find{|field| field.get_type.to_s == TYPES[type] }
end
input_stream(ruby_string) click to toggle source
# File lib/gedcomx.rb, line 175
def self.input_stream(ruby_string)
  java.io.ByteArrayInputStream.new( to_java_string(ruby_string).getBytes )
end
interpreted_value(field_obj) click to toggle source
# File lib/gedcomx.rb, line 151
def self.interpreted_value(field_obj)
  return if field_obj.nil?
  values = field_obj.get_values

  # If more than 1 value exists, we will choose 'Interpreted'
  if values.length > 1
    value = values.select{|val| val.get_type.to_s.include? 'Interpreted' }.first
  else
    value = values[0]
  end

  return value
end
java_uri_class() click to toggle source
# File lib/gedcomx.rb, line 123
def self.java_uri_class
  Java::OrgGedcomxCommon::URI
end
location_mapping(key) click to toggle source
# File lib/gedcomx.rb, line 165
def self.location_mapping(key)
  value = LOCATION_MAP[key.downcase.to_sym]
  return value unless value.nil?
  return :city if key.downcase.include? 'town'
end
new_uri(uri_string) click to toggle source
# File lib/gedcomx.rb, line 127
def self.new_uri(uri_string)
  self.java_uri_class.new(uri_string.to_s)
end
to_java_string(ruby_string) click to toggle source
# File lib/gedcomx.rb, line 171
def self.to_java_string(ruby_string)
  java.lang.String.new(ruby_string)
end