Class: Mods::OriginInfo
- Inherits:
-
Object
- Object
- Mods::OriginInfo
- Defined in:
- lib/mods/origin_info.rb
Constant Summary collapse
- DATE_ELEMENTS =
['dateIssued', 'dateCreated', 'dateCaptured', 'dateValid', 'dateModified', 'copyrightDate', 'dateOther']
Instance Attribute Summary collapse
-
#xml ⇒ Object
readonly
Returns the value of attribute xml.
Instance Method Summary collapse
- #dates ⇒ Object
-
#initialize(xml) ⇒ OriginInfo
constructor
A new instance of OriginInfo.
- #key_dates ⇒ Object
Constructor Details
#initialize(xml) ⇒ OriginInfo
Returns a new instance of OriginInfo.
7 8 9 |
# File 'lib/mods/origin_info.rb', line 7 def initialize(xml) @xml = xml end |
Instance Attribute Details
#xml ⇒ Object (readonly)
Returns the value of attribute xml.
5 6 7 |
# File 'lib/mods/origin_info.rb', line 5 def xml @xml end |
Instance Method Details
#dates ⇒ Object
11 12 13 |
# File 'lib/mods/origin_info.rb', line 11 def dates DATE_ELEMENTS.flat_map { |element| xml.public_send(element) } end |
#key_dates ⇒ Object
15 16 17 18 19 |
# File 'lib/mods/origin_info.rb', line 15 def key_dates d = dates.select { |x| x.keyDate == 'yes' } d += dates.select { |x| x.point == 'end' && d.any? { |date| date.name == x.name && date.point == 'start' } } end |