Class: Ddr::Models::FindingAid
- Inherits:
-
Object
- Object
- Ddr::Models::FindingAid
- Defined in:
- lib/ddr/models/finding_aid.rb
Constant Summary collapse
- EAD_XMLNS =
"urn:isbn:1-931666-22-9"
Instance Attribute Summary collapse
-
#ead_id ⇒ Object
readonly
Returns the value of attribute ead_id.
Instance Method Summary collapse
- #abstract ⇒ Object
- #collection_date_span ⇒ Object
- #collection_number ⇒ Object
- #collection_title ⇒ Object
- #extent ⇒ Object
-
#initialize(ead_id) ⇒ FindingAid
constructor
A new instance of FindingAid.
- #repository ⇒ Object
-
#title ⇒ Object
The finding aid title.
- #url ⇒ Object
Constructor Details
#initialize(ead_id) ⇒ FindingAid
Returns a new instance of FindingAid.
10 11 12 |
# File 'lib/ddr/models/finding_aid.rb', line 10 def initialize(ead_id) @ead_id = ead_id end |
Instance Attribute Details
#ead_id ⇒ Object (readonly)
Returns the value of attribute ead_id.
6 7 8 |
# File 'lib/ddr/models/finding_aid.rb', line 6 def ead_id @ead_id end |
Instance Method Details
#abstract ⇒ Object
43 44 45 |
# File 'lib/ddr/models/finding_aid.rb', line 43 def abstract collection.xpath('ead:did/ead:abstract', ead: EAD_XMLNS).text end |
#collection_date_span ⇒ Object
27 28 29 |
# File 'lib/ddr/models/finding_aid.rb', line 27 def collection_date_span collection.xpath('ead:did/ead:unitdate[@type="inclusive"]', ead: EAD_XMLNS).text end |
#collection_number ⇒ Object
31 32 33 |
# File 'lib/ddr/models/finding_aid.rb', line 31 def collection_number collection.xpath('ead:did/ead:unitid', ead: EAD_XMLNS).text end |
#collection_title ⇒ Object
35 36 37 |
# File 'lib/ddr/models/finding_aid.rb', line 35 def collection_title collection.xpath('ead:did/ead:unittitle', ead: EAD_XMLNS).text end |
#extent ⇒ Object
39 40 41 |
# File 'lib/ddr/models/finding_aid.rb', line 39 def extent collection.xpath('ead:did/ead:physdesc/ead:extent', ead: EAD_XMLNS).map(&:text).join("; ") end |
#repository ⇒ Object
23 24 25 |
# File 'lib/ddr/models/finding_aid.rb', line 23 def repository collection.xpath('ead:did/ead:repository/ead:corpname', ead: EAD_XMLNS).text end |
#title ⇒ Object
The finding aid title
19 20 21 |
# File 'lib/ddr/models/finding_aid.rb', line 19 def title doc.css("titleproper").children.first.text.strip end |
#url ⇒ Object
14 15 16 |
# File 'lib/ddr/models/finding_aid.rb', line 14 def url doc.css("eadid").attr("url").text end |