Class: EAC::Person
Defined Under Namespace
Classes: Biography, Event, Name
Instance Attribute Summary collapse
-
#record_id ⇒ Object
readonly
Returns the value of attribute record_id.
Instance Method Summary collapse
- #biography ⇒ Object
-
#initialize(xml_doc) ⇒ Person
constructor
A new instance of Person.
- #names ⇒ Object
- #occupations ⇒ 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
#biography ⇒ Object
62 63 64 65 66 67 |
# File 'lib/eac.rb', line 62 def biography if @biography.nil? @biography = Biography.new(@xml) end @biography end |
#names ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/eac.rb', line 42 def names if @names.nil? @names = [] name_entries = @xml.xpath("//ns:cpfDescription/ns:identity/ns:nameEntry", ns:'urn:isbn:1-931666-33-4') name_entries.each do |entry| @names << Name.new(entry) end end @names end |
#occupations ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/eac.rb', line 54 def occupations if @occupations.nil? @occupations = @xml.xpath("//ns:occupations/ns:occupation/ns:term", ns:'urn:isbn:1-931666-33-4').map(&:text) end @occupations end |