Class: ASpaceExport::Serializer

Inherits:
Object
  • Object
show all
Defined in:
backend/app/exporters/lib/exporter.rb

Class Method Summary collapse

Class Method Details

.inherited(subclass) ⇒ Object



102
103
104
# File 'backend/app/exporters/lib/exporter.rb', line 102

def self.inherited(subclass)
  ASpaceExport.register_serializer(subclass)
end

.serializer_for(name) ⇒ Object



107
108
109
# File 'backend/app/exporters/lib/exporter.rb', line 107

def self.serializer_for(name)
  @serializer_for = name
end

.serializer_for?(name) ⇒ Boolean

Returns:

  • (Boolean)


112
113
114
# File 'backend/app/exporters/lib/exporter.rb', line 112

def self.serializer_for?(name)
  @serializer_for == name
end

.with_namespace(prefix, xml) ⇒ Object

use a serializer to embed wrapped data for example, MODS data wrapped in METS



118
119
120
121
122
123
# File 'backend/app/exporters/lib/exporter.rb', line 118

def self.with_namespace(prefix, xml)
  ns = xml.doc.root.namespace_definitions.find {|ns| ns.prefix == prefix}
  xml.instance_variable_set(:@sticky_ns, ns)
  yield
  xml.instance_variable_set(:@sticky_ns, nil)
end