Class: Relaton::Cli::RelatonFile
- Inherits:
-
Object
- Object
- Relaton::Cli::RelatonFile
- Defined in:
- lib/relaton/cli/relaton_file.rb
Class Method Summary collapse
-
.concatenate(source, outfile, options = {}) ⇒ Object
Concatenate files.
-
.extract(source, outdir, options = {}) ⇒ Object
Extract files.
Instance Method Summary collapse
- #concatenate ⇒ Object
- #extract ⇒ Object
-
#initialize(source, options = {}) ⇒ RelatonFile
constructor
A new instance of RelatonFile.
Constructor Details
#initialize(source, options = {}) ⇒ RelatonFile
Returns a new instance of RelatonFile.
7 8 9 10 11 12 |
# File 'lib/relaton/cli/relaton_file.rb', line 7 def initialize(source, = {}) @source = source = @outdir = .fetch(:outdir, nil) @outfile = .fetch(:outfile, nil) end |
Class Method Details
.concatenate(source, outfile, options = {}) ⇒ Object
Concatenate files
This interface expect us to provide a source directory, output file and custom configuration options. Normally, this expect the source directory to contain RXL fles, but it also converts any YAML files to RXL and then finally combines those together.
This interface also allow us to provdie options like title and organization and then it usage those details to generate the collection file.
52 53 54 |
# File 'lib/relaton/cli/relaton_file.rb', line 52 def self.concatenate(source, outfile, = {}) new(source, .merge(outfile: outfile)).concatenate end |
.extract(source, outdir, options = {}) ⇒ Object
Extract files
This interface expect us to provide a source directory, output directory and custom configuration options. Then it wll extract Relaton XML files to output directory from the source directory During this process it will use custom options when available.
33 34 35 |
# File 'lib/relaton/cli/relaton_file.rb', line 33 def self.extract(source, outdir, = {}) new(source, .merge(outdir: outdir)).extract end |
Instance Method Details
#concatenate ⇒ Object
18 19 20 |
# File 'lib/relaton/cli/relaton_file.rb', line 18 def concatenate write_to_file(bibcollection.to_xml) end |
#extract ⇒ Object
14 15 16 |
# File 'lib/relaton/cli/relaton_file.rb', line 14 def extract extract_and_write_to_files end |