Sha256: b54a1ff80f4f2ab87cf8be895440b3f7e9ba75b85d6ec26844c064547573e547
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) require File.join(dir, 'happymapper') file_contents = File.read(dir + '/../spec/fixtures/family_tree.xml') module FamilySearch class AlternateIds include HappyMapper tag 'alternateIds' has_many :ids, String, :tag => 'id' end class Information include HappyMapper has_one :alternateIds, AlternateIds end class Person include HappyMapper attribute :version, String attribute :modified, Time attribute :id, String has_one :information, Information end class Persons include HappyMapper has_many :person, Person end class FamilyTree include HappyMapper tag 'familytree' attribute :version, String attribute :status_message, String, :tag => 'statusMessage' attribute :status_code, String, :tag => 'statusCode' has_one :persons, Persons end end familytree = FamilySearch::FamilyTree.parse(file_contents) familytree.persons.person.each do |p| puts p.id, p.information.alternateIds.ids, '' end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nokogiri-happymapper-0.3.4 | examples/family_tree.rb |
nokogiri-happymapper-0.3.3 | examples/family_tree.rb |