Class: EAC::Person
Defined Under Namespace
Classes: Name
Instance Attribute Summary collapse
-
#record_id ⇒ Object
readonly
Returns the value of attribute record_id.
Instance Method Summary collapse
-
#initialize(xml_doc) ⇒ Person
constructor
A new instance of Person.
- #names ⇒ Object
- #names_from_entries ⇒ Object
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_id ⇒ Object (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
#names ⇒ Object
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_entries ⇒ Object
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 |