Class: Stanford::Mods::Imprint
- Inherits:
-
Object
- Object
- Stanford::Mods::Imprint
- Defined in:
- lib/stanford-mods/imprint.rb
Overview
Get the imprint information from originInfo elements (and sub elements) to create display strings
This code is adapted from the mods_display gem. In a perfect world, this code would make use of the date_parsing class instead of reimplementing pieces of it; however, the date_parsing class only does years, and this does finer tuned dates and also reformats them according to the encoding.
Instance Method Summary collapse
- #display_str ⇒ Object
- #imprint_statements ⇒ Object
-
#initialize(originInfo_ng_nodeset) ⇒ Imprint
constructor
A new instance of Imprint.
Constructor Details
#initialize(originInfo_ng_nodeset) ⇒ Imprint
Returns a new instance of Imprint.
12 13 14 |
# File 'lib/stanford-mods/imprint.rb', line 12 def initialize(originInfo_ng_nodeset) @originInfo_ng_nodeset = originInfo_ng_nodeset end |
Instance Method Details
#display_str ⇒ Object
36 37 38 |
# File 'lib/stanford-mods/imprint.rb', line 36 def display_str imprint_statements.join('; ') if imprint_statements.present? end |
#imprint_statements ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/stanford-mods/imprint.rb', line 19 def imprint_statements results = [] @originInfo_ng_nodeset.each do |origin_info_node| edition = edition_vals_str(origin_info_node) place = place_vals_str(origin_info_node) publisher = publisher_vals_str(origin_info_node) dates = date_str(origin_info_node) place_pub = compact_and_join_with_delimiter([place, publisher], ' : ') edition_place_pub = compact_and_join_with_delimiter([edition, place_pub], ' - ') ed_place_pub_dates = compact_and_join_with_delimiter([edition_place_pub, dates], ', ') results << ed_place_pub_dates unless ed_place_pub_dates.empty? end results end |