Class: Kiba::Extend::Destinations::Marc
- Inherits:
-
Object
- Object
- Kiba::Extend::Destinations::Marc
show all
- Extended by:
- Destinationable
- Defined in:
- lib/kiba/extend/destinations/marc.rb
Overview
Writes MARC records to a file
This is a wrapper around ruby-marc
’s MARC::Writer
, so see
relevant documentation in:
https://github.com/ruby-marc/ruby-marc/blob/main/lib/marc/writer.rb
Class Method Summary
collapse
Instance Method Summary
collapse
as_source_class, is_destination?, special_options
#default_args, #default_file_options, #labeled_options, #options_key, #path_key, #requires_path?
Constructor Details
#initialize(filename:, allow_oversized: nil) ⇒ Marc
Returns a new instance of Marc.
48
49
50
51
|
# File 'lib/kiba/extend/destinations/marc.rb', line 48
def initialize(filename:, allow_oversized: nil)
@writer = MARC::Writer.new(filename)
writer.allow_oversized = allow_oversized if allow_oversized
end
|
Class Method Details
.as_source_class ⇒ Object
19
20
21
|
# File 'lib/kiba/extend/destinations/marc.rb', line 19
def as_source_class
Kiba::Extend::Sources::Marc
end
|
.default_file_options ⇒ Object
23
24
25
|
# File 'lib/kiba/extend/destinations/marc.rb', line 23
def default_file_options
nil
end
|
.options_key ⇒ Object
27
28
29
|
# File 'lib/kiba/extend/destinations/marc.rb', line 27
def options_key
nil
end
|
.path_key ⇒ Object
31
32
33
|
# File 'lib/kiba/extend/destinations/marc.rb', line 31
def path_key
:filename
end
|
.requires_path? ⇒ Boolean
35
36
37
|
# File 'lib/kiba/extend/destinations/marc.rb', line 35
def requires_path?
true
end
|
.special_options ⇒ Object
39
40
41
|
# File 'lib/kiba/extend/destinations/marc.rb', line 39
def special_options
[:allow_oversized]
end
|
Instance Method Details
#close ⇒ Object
59
60
61
|
# File 'lib/kiba/extend/destinations/marc.rb', line 59
def close
writer.close
end
|
#write(record) ⇒ Object
54
55
56
|
# File 'lib/kiba/extend/destinations/marc.rb', line 54
def write(record)
writer.write(record)
end
|