Class: MarcXMLBibConverter
- Inherits:
-
Converter
show all
- Defined in:
- backend/app/converters/marcxml_bib_converter.rb
Class Method Summary
collapse
Methods inherited from Converter
for, #get_output_path, #import_options, import_options, inherited, #initialize, list_import_types, register_converter, #remove_files, #run
Constructor Details
This class inherits a constructor from Converter
Class Method Details
49
50
51
52
53
54
55
|
# File 'backend/app/converters/marcxml_bib_converter.rb', line 49
def self.configure
super do |config|
config.doc_frag_nodes << 'record'
config["/record"] = self.BASE_RECORD_MAP
yield config if block_given?
end
end
|
.for_subjects_and_agents_only(input_file) ⇒ Object
37
38
39
40
41
42
43
44
45
46
|
# File 'backend/app/converters/marcxml_bib_converter.rb', line 37
def self.for_subjects_and_agents_only(input_file)
new(input_file).instance_eval do
@batch.record_filter = ->(record) {
AgentManager.known_agent_type?(record.class.record_type) ||
record.class.record_type == 'subject'
}
self
end
end
|
.import_types(show_hidden = false) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'backend/app/converters/marcxml_bib_converter.rb', line 12
def self.import_types(show_hidden = false)
[
{
:name => "marcxml",
:description => "Import all record types from a MARC XML file"
},
{
:name => "marcxml_subjects_and_agents",
:description => "Import only subjects and agents from a MARC XML file"
}
]
end
|
.instance_for(type, input_file) ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'backend/app/converters/marcxml_bib_converter.rb', line 26
def self.instance_for(type, input_file)
if type == "marcxml"
self.new(input_file)
elsif type == "marcxml_subjects_and_agents"
self.for_subjects_and_agents_only(input_file)
else
nil
end
end
|