Sha256: 488985e02d9d99ec6f13d749a65dd9edaf56c13740c6037809ea10610ac31649

Contents?: true

Size: 628 Bytes

Versions: 10

Compression:

Stored size: 628 Bytes

Contents

class ModsDisplay::Collection < ModsDisplay::Field

  def label
    super || "Collection"
  end

  def fields
    return_fields = []
    @values.each do |value|
      if value.respond_to?(:titleInfo) and
         value.respond_to?(:typeOfResource) and
         value.typeOfResource.attributes.length > 0 and
         value.typeOfResource.attributes.first.has_key?("collection") and
         value.typeOfResource.attributes.first["collection"].value == "yes"
        return_fields << ModsDisplay::Values.new(:label => label, :values => [value.titleInfo.text.strip])
      end
    end
    collapse_fields(return_fields)
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mods_display-0.2.4 lib/mods_display/fields/collection.rb
mods_display-0.2.3 lib/mods_display/fields/collection.rb
mods_display-0.2.2 lib/mods_display/fields/collection.rb
mods_display-0.2.1 lib/mods_display/fields/collection.rb
mods_display-0.2.0 lib/mods_display/fields/collection.rb
mods_display-0.1.4 lib/mods_display/fields/collection.rb
mods_display-0.1.3 lib/mods_display/fields/collection.rb
mods_display-0.1.2 lib/mods_display/fields/collection.rb
mods_display-0.1.1 lib/mods_display/fields/collection.rb
mods_display-0.1.0 lib/mods_display/fields/collection.rb