Class: ModsDisplay::RelatedItemConcerns::RelatedItemValue
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- ModsDisplay::RelatedItemConcerns::RelatedItemValue
- Defined in:
- lib/mods_display/related_item_concerns.rb
Class Method Summary collapse
Instance Method Summary collapse
- #collection? ⇒ Boolean
- #constituent? ⇒ Boolean
- #host? ⇒ Boolean
- #location? ⇒ Boolean
- #location_nodeset ⇒ Object
- #location_url_nodeset ⇒ Object
- #note_nodeset ⇒ Object
- #reference? ⇒ Boolean
- #titleInfo_nodeset ⇒ Object
- #type_attribute ⇒ Object
- #typeOfResource_nodeset ⇒ Object
Class Method Details
.for_stanford_mods_elements(stanford_mods_elements) ⇒ Object
59 60 61 |
# File 'lib/mods_display/related_item_concerns.rb', line 59 def self.for_stanford_mods_elements(stanford_mods_elements) stanford_mods_elements.map { |element| new(element) } end |
Instance Method Details
#collection? ⇒ Boolean
12 13 14 |
# File 'lib/mods_display/related_item_concerns.rb', line 12 def collection? @collection ||= typeOfResource_nodeset.first&.get_attribute('collection') == 'yes' end |
#constituent? ⇒ Boolean
16 17 18 |
# File 'lib/mods_display/related_item_concerns.rb', line 16 def constituent? @constituent ||= type_attribute == 'constituent' end |
#host? ⇒ Boolean
20 21 22 |
# File 'lib/mods_display/related_item_concerns.rb', line 20 def host? @host ||= type_attribute == 'host' end |
#location? ⇒ Boolean
24 25 26 27 28 29 |
# File 'lib/mods_display/related_item_concerns.rb', line 24 def location? @location ||= !collection? && !reference? && location_nodeset.length.positive? && titleInfo_nodeset.empty? end |
#location_nodeset ⇒ Object
39 40 41 |
# File 'lib/mods_display/related_item_concerns.rb', line 39 def location_nodeset @location_nodeset ||= xpath('mods:location', mods: MODS_NS) end |
#location_url_nodeset ⇒ Object
43 44 45 |
# File 'lib/mods_display/related_item_concerns.rb', line 43 def location_url_nodeset @location_url_nodeset ||= xpath('mods:location/mods:url', mods: MODS_NS) end |
#note_nodeset ⇒ Object
51 52 53 |
# File 'lib/mods_display/related_item_concerns.rb', line 51 def note_nodeset @note_nodeset ||= xpath('mods:note', mods: MODS_NS) end |
#reference? ⇒ Boolean
31 32 33 |
# File 'lib/mods_display/related_item_concerns.rb', line 31 def reference? @reference ||= !collection? && type_attribute == 'isReferencedBy' end |
#titleInfo_nodeset ⇒ Object
47 48 49 |
# File 'lib/mods_display/related_item_concerns.rb', line 47 def titleInfo_nodeset @titleInfo_nodeset ||= xpath('mods:titleInfo', mods: MODS_NS) end |
#type_attribute ⇒ Object
55 56 57 |
# File 'lib/mods_display/related_item_concerns.rb', line 55 def type_attribute @type_attribute ||= get_attribute('type') end |
#typeOfResource_nodeset ⇒ Object
35 36 37 |
# File 'lib/mods_display/related_item_concerns.rb', line 35 def typeOfResource_nodeset @typeOfResource_nodeset ||= xpath('mods:typeOfResource', mods: MODS_NS) end |