Class: Kiba::Extend::Destinations::Marc
- Inherits:
-
Object
- Object
- Kiba::Extend::Destinations::Marc
show all
- Includes:
- 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
#ensure_dir, included, is_destination?
Constructor Details
#initialize(filename:, allow_oversized: nil) ⇒ Marc
Returns a new instance of Marc.
36
37
38
39
40
41
|
# File 'lib/kiba/extend/destinations/marc.rb', line 36
def initialize(filename:, allow_oversized: nil)
@filename = filename
ensure_dir
@writer = MARC::Writer.new(filename)
writer.allow_oversized = allow_oversized if allow_oversized
end
|
Class Method Details
.as_source_class ⇒ Object
19
|
# File 'lib/kiba/extend/destinations/marc.rb', line 19
def as_source_class = Kiba::Extend::Sources::Marc
|
.default_file_options ⇒ Object
21
|
# File 'lib/kiba/extend/destinations/marc.rb', line 21
def default_file_options = nil
|
.options_key ⇒ Object
23
|
# File 'lib/kiba/extend/destinations/marc.rb', line 23
def options_key = nil
|
.path_key ⇒ Object
25
|
# File 'lib/kiba/extend/destinations/marc.rb', line 25
def path_key = :filename
|
.requires_path? ⇒ Boolean
27
|
# File 'lib/kiba/extend/destinations/marc.rb', line 27
def requires_path? = true
|
.special_options ⇒ Object
29
|
# File 'lib/kiba/extend/destinations/marc.rb', line 29
def special_options = [:allow_oversized]
|
Instance Method Details
#close ⇒ Object
49
50
51
|
# File 'lib/kiba/extend/destinations/marc.rb', line 49
def close
writer.close
end
|
#write(record) ⇒ Object
44
45
46
|
# File 'lib/kiba/extend/destinations/marc.rb', line 44
def write(record)
writer.write(record)
end
|