Sha256: 4515ff3b8c2153750fc63894f520b3a7c9ee88b0d43019ba8b985f21b67d9867

Contents?: true

Size: 583 Bytes

Versions: 3

Compression:

Stored size: 583 Bytes

Contents

class ModsDisplay::Location < ModsDisplay::Field
  
  def fields
    return_values = []
    @value.each do |val|
      return_values << ModsDisplay::Values.new(:label => label || location_label(val), :values => [val.text])
    end
    return_values
  end
  
  private
  
  def location_label(element)
    if element.attributes["type"].respond_to?(:value) && location_labels.has_key?(element.attributes["type"].value)
      location_labels[element.attributes["type"].value]
    else
      "Location"
    end
  end
  
  def location_labels
    {"repository" => "Repository"}
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

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