Sha256: b266fb5aa0403011d9c7d5f85ca989464136987a9b6ee8352eec425e18a224c0

Contents?: true

Size: 1.76 KB

Versions: 4

Compression:

Stored size: 1.76 KB

Contents

class ModsDisplay::Identifier < ModsDisplay::Field

  def fields
    return_fields = @values.map do |value|
      ModsDisplay::Values.new(:label => displayLabel(value) || identifier_label(value), :values => [value.text])
    end
    collapse_fields(return_fields)
  end

  private

  def identifier_label(element)
    if element.attributes["type"].respond_to?(:value)
      return identifier_labels[element.attributes["type"].value] || "#{element.attributes["type"].value}:"
    end
    I18n.t('mods_display.identifier')
  end

  def identifier_labels
    {"local"                     => I18n.t('mods_display.identifier'),
     "isbn"                      => I18n.t('mods_display.isbn'),
     "issn"                      => I18n.t('mods_display.issn'),
     "issn-l"                    => I18n.t('mods_display.issn'),
     "doi"                       => I18n.t('mods_display.doi'),
     "hdl"                       => I18n.t('mods_display.handle'),
     "isrc"                      => I18n.t('mods_display.isrc'),
     "ismn"                      => I18n.t('mods_display.ismn'),
     "issue number"              => I18n.t('mods_display.issue_number'),
     "lccn"                      => I18n.t('mods_display.lccn'),
     "oclc"                      => I18n.t('mods_display.oclc'),
     "matrix number"             => I18n.t('mods_display.matrix_number'),
     "music publisher"           => I18n.t('mods_display.music_publisher'),
     "music plate"               => I18n.t('mods_display.music_plate'),
     "sici"                      => I18n.t('mods_display.sici'),
     "upc"                       => I18n.t('mods_display.upc'),
     "videorecording identifier" => I18n.t('mods_display.videorecording_identifier'),
     "stock number"              => I18n.t('mods_display.stock_number')}
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mods_display-0.3.3 lib/mods_display/fields/identifier.rb
mods_display-0.3.2 lib/mods_display/fields/identifier.rb
mods_display-0.3.1 lib/mods_display/fields/identifier.rb
mods_display-0.3.0 lib/mods_display/fields/identifier.rb