Class: EAC::Person

Inherits:
Doc
  • Object
show all
Defined in:
lib/eac.rb

Defined Under Namespace

Classes: Name

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml_doc) ⇒ Person

Returns a new instance of Person.



35
36
37
38
39
40
# File 'lib/eac.rb', line 35

def initialize(xml_doc)
  super
  @record_id = xml_doc.xpath("//ns:control/ns:recordId",
                            ns:'urn:isbn:1-931666-33-4').text

end

Instance Attribute Details

#record_idObject (readonly)

Returns the value of attribute record_id.



34
35
36
# File 'lib/eac.rb', line 34

def record_id
  @record_id
end

Instance Method Details

#namesObject



42
43
44
45
46
47
# File 'lib/eac.rb', line 42

def names
  if @names.nil?
     @names = names_from_entries
  end
  @names
end

#names_from_entriesObject



49
50
51
52
53
54
55
56
57
# File 'lib/eac.rb', line 49

def names_from_entries
  name_elements = []
  name_entries = @xml.xpath("//ns:cpfDescription/ns:identity/ns:nameEntry",
                                ns:'urn:isbn:1-931666-33-4')
  name_entries.each do |entry|
    name_elements << Name.new(entry)
  end
  name_elements
end