Sha256: 359f6c02a0b684970b7a16e9891b9b75933bd64896c2ad6145444e618f1e92de

Contents?: true

Size: 776 Bytes

Versions: 4

Compression:

Stored size: 776 Bytes

Contents

class ModsDisplay::Description < ModsDisplay::Field

  def fields
    description_fields.map do |description|
      ModsDisplay::Values.new({:label => (label || description_label(description) || labels[description.name.to_sym] || "Physical Description"),
                               :values => [description.text]})
    end
  end

  def description_label(element)
    element.attributes["displayLabel"].value if element.attributes["displayLabel"].respond_to?(:value)
  end

  private

  def description_fields
    @value.children.select do |child|
      labels.keys.include?(child.name.to_sym)
    end
  end

  def labels
    {:form          => "Form",
     :extent        => "Extent",
     :digitalOrigin => "Digital Origin",
     :note          => "Note"
     }
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mods_display-0.0.1.beta4 lib/mods_display/fields/description.rb
mods_display-0.0.1.beta3 lib/mods_display/fields/description.rb
mods_display-0.0.1.beta2 lib/mods_display/fields/description.rb
mods_display-0.0.1.beta1 lib/mods_display/fields/description.rb