Module: RIFCS::Collection

Includes:
RIFCS
Defined in:
lib/rif-cs/collection.rb

Instance Method Summary collapse

Methods included from RIFCS

addresses, camelize, coverage, electronic_addresses, existence_dates, list_of, locations, names, physical_addresses, related_info, related_objects, rights, spatials, subjects, temporals, #to_rif

Instance Method Details

#citation_info(list, xml) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/rif-cs/collection.rb', line 38

def citation_info(list, xml)
  return if list.nil? or list.empty?
  list.each do |citation|
    xml.fullCitation_(citation[:full_citation][:value], :style => citation[:full_citation][:style]) 
    xml. do
      meta_obj = citation[:citation_metadata]
      xml.identifier(meta_obj[:identifier][:value], :type => meta_obj[:identifier][:type])
      meta_obj[:contributor].each do |name|
        xml.contributor_(:seq => name[:seq]) do
          name[:name_parts].each do |part|
            xml.namePart_(part[:value], :type => part[:type])
          end
        end
      end
      xml.title_(meta_obj[:title])
      xml.edition_(meta_obj[:edition])
      xml.publisher_(meta_obj[:publisher]) if meta_obj.has_key?(:publisher)
      xml.placePublished_(meta_obj[:place_published])
      meta_obj[:date].each do |d|
        xml.date_(d[:value], :type => d[:type])
      end if meta_obj.has_key?(:date)
      xml.url_(meta_obj[:url])
      xml.context_(meta_obj[:context])
    end
  end
end

#collection_keyObject



65
66
67
# File 'lib/rif-cs/collection.rb', line 65

def collection_key
  raise "Supply a collection_key attribute or implement a method"
end

#collection_originating_sourceObject



70
71
72
# File 'lib/rif-cs/collection.rb', line 70

def collection_originating_source
  raise "Supply a collection_originating_source attribute or implement a method"
end

#to_registry_node(encoding = 'UTF-8') ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/rif-cs/collection.rb', line 6

def to_registry_node(encoding='UTF-8')
  Nokogiri::XML::Builder.new(:encoding => encoding) do |xml|
    xml.registryObject_(:group => collection_group) do

      xml.key_ collection_key
      xml.originatingSource_ collection_originating_source if respond_to?(:collection_originating_source)

      xml.collection_(:dateModified => collection_date_modified, :type => collection_type, :dateAccessioned => collection_date_accessioned) do
        RIFCS::list_of(collection_identifiers, :identifiers, xml) if respond_to?(:collection_identifiers)

        RIFCS::names(collection_names, xml) if respond_to?(:collection_names)

        RIFCS::locations(collection_locations, xml) if respond_to?(:collection_locations)

        RIFCS::coverage(collection_coverage, xml) if respond_to?(:collection_coverage)

        RIFCS::related_objects(collection_related_objects, xml) if respond_to?(:collection_related_objects)

        RIFCS::subjects(collection_subjects, xml) if respond_to?(:collection_subjects)

        RIFCS::list_of(collection_descriptions, :descriptions, xml) if respond_to?(:collection_descriptions)

        RIFCS::rights(collection_rights, xml) if respond_to?(:collection_rights)

        RIFCS::related_info(collection_related_info, xml) if respond_to?(:collection_related_infos)

        citation_info(collection_citation_info, xml) if respond_to?(:collection_citation_info)
      end # collection
    end
  end
end