Class: ModsDisplay::Collection

Inherits:
Field
  • Object
show all
Defined in:
lib/mods_display/fields/collection.rb

Instance Method Summary collapse

Methods inherited from Field

#initialize, #to_html

Constructor Details

This class inherits a constructor from ModsDisplay::Field

Instance Method Details

#fieldsObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/mods_display/fields/collection.rb', line 7

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

#labelObject



3
4
5
# File 'lib/mods_display/fields/collection.rb', line 3

def label
  super || "Collection"
end