Class: PennMARC::Edition

Inherits:
Helper
  • Object
show all
Defined in:
lib/pennmarc/helpers/edition.rb

Overview

Do Edition and edition-related field processing.

Class Method Summary collapse

Methods included from Util

#datafield_and_linked_alternate, #join_and_squish, #join_subfields, #linked_alternate, #linked_alternate_not_6_or_8, #prefixed_subject_and_alternate, #remove_paren_value_from_subfield_i, #subfield_defined?, #subfield_in?, #subfield_not_in?, #subfield_undefined?, #subfield_value?, #subfield_value_in?, #subfield_value_not_in?, #subfield_values, #subfield_values_for, #substring_after, #substring_before, #translate_relator, #trim_trailing, #valid_subject_genre_source_code?

Class Method Details

.other_show(record, relator_map: Mappers.relator) ⇒ Array<String>

Entry for another available edition of the target item (horizontal relationship). When a note is generated from this field, the introductory phrase Other editions available: may be generated based on the field tag for display. www.loc.gov/marc/bibliographic/bd775.html

Parameters:

  • record (MARC::Record)
  • relator_map (Hash) (defaults to: Mappers.relator)

Returns:

  • (Array<String>)

    array of other edition strings



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/pennmarc/helpers/edition.rb', line 39

def other_show(record, relator_map: Mappers.relator)
  values = record.fields('775').filter_map do |field|
    next unless subfield_defined?(field, :i)

    other_edition_value(field, relator_map)
  end
  values + record.fields('880').filter_map do |field|
    next unless field.indicator2.blank? && subfield_value_in?(field, '6', %w[775]) &&
                subfield_defined?(field, 'i')

    other_edition_value(field, relator_map)
  end
end

.show(record) ⇒ Array<String>

Edition values for display on a record page. Field 250 is information relating to the edition of a work as determined by applicable cataloging rules. For mixed materials, field 250 is used to record statements relating to collections that contain versions of works existing in two or more versions (or states) in single or multiple copies (e.g., different drafts of a film script). For continuing resources, this field is not used for sequential edition statements such as 1st- ed. This type of information is contained in field 362 (Dates of Publication and/or Volume Designation). www.loc.gov/marc/bibliographic/bd250.html

Parameters:

  • record (MARC::Record)

Returns:

  • (Array<String>)

    array of editions and their alternates



16
17
18
19
20
# File 'lib/pennmarc/helpers/edition.rb', line 16

def show(record)
  record.fields('250').map { |field|
    join_subfields(field, &subfield_not_in?(%w[6 8]))
  } + linked_alternate_not_6_or_8(record, '250')
end

.values(record) ⇒ String, NilClass

Edition values for display in search results. Just grab the first 250 field.

Parameters:

  • record (MARC::Record)

Returns:

  • (String, NilClass)

    string of all first 250 subfields, excluding 6 and 8



25
26
27
28
29
30
# File 'lib/pennmarc/helpers/edition.rb', line 25

def values(record)
  edition = record.fields('250').first
  return if edition.blank?

  join_subfields(edition, &subfield_not_in?(%w[6 8]))
end