Class: METSSerializer

Inherits:
ASpaceExport::Serializer show all
Defined in:
backend/app/exporters/serializers/mets.rb

Instance Method Summary collapse

Methods inherited from ASpaceExport::Serializer

inherited, serializer_for, serializer_for?, with_namespace

Instance Method Details

#build(data, opts = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'backend/app/exporters/serializers/mets.rb', line 4

def build(data, opts = {})
  builder = Nokogiri::XML::Builder.new(:encoding => "UTF-8") do |xml|
    if opts[:dmd]
      mets(data, xml, opts[:dmd])
    else
      mets(data, xml)
    end
  end

  builder
end

#serialize(data, opts = {}) ⇒ Object



17
18
19
20
21
# File 'backend/app/exporters/serializers/mets.rb', line 17

def serialize(data, opts = {})
  builder = build(data, opts)

  builder.to_xml
end