Class: ModsDisplay::Edition

Inherits:
Field
  • Object
show all
Defined in:
lib/mods_display/fields/edition.rb

Instance Method Summary collapse

Methods inherited from Field

#initialize, #label, #render_in, #to_html

Constructor Details

This class inherits a constructor from ModsDisplay::Field

Instance Method Details

#fieldsObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/mods_display/fields/edition.rb', line 5

def fields
  return_fields = @stanford_mods_elements.map do |origin_info_element|
    edition_value = Stanford::Mods::Imprint.new(origin_info_element).edition_vals_str
    next unless edition_value.present?

    # remove trailing spaces (thanks MARC, for catalog card formatting!)
    edition_value.gsub!(%r{ */$}, '')

    ModsDisplay::Values.new(
      label: I18n.t('mods_display.edition'),
      values: [edition_value],
      field: self
    )
  end.compact
  collapse_fields(return_fields)
end