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.
-
.split(source, outdir = nil, options = {}) ⇒ Object
Split collection.
Instance Method Summary collapse
- #concatenate ⇒ Object
- #extract ⇒ Object
-
#initialize(source, options = {}) ⇒ RelatonFile
constructor
A new instance of RelatonFile.
- #split ⇒ Object
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 @options = @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.
57 58 59 |
# File 'lib/relaton/cli/relaton_file.rb', line 57 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 file / directory, output directory and custom configuration options. Then it wll extract Relaton XML file / files to output directory from the source file / directory. During this process it will use custom options when available.
38 39 40 |
# File 'lib/relaton/cli/relaton_file.rb', line 38 def self.extract(source, outdir, = {}) new(source, .merge(outdir: outdir)).extract end |
.split(source, outdir = nil, options = {}) ⇒ Object
Split collection
This interface expects us to provide a Relaton Collection file and also an output directory, then it will split that collection into multiple files.
By default it usages ‘rxl` extension for these new files, but we can also customize that by providing the correct one as `extension` option parameter.
75 76 77 |
# File 'lib/relaton/cli/relaton_file.rb', line 75 def self.split(source, outdir = nil, = {}) new(source, .merge(outdir: outdir)).split end |
Instance Method Details
#concatenate ⇒ Object
18 19 20 |
# File 'lib/relaton/cli/relaton_file.rb', line 18 def concatenate concatenate_and_write_to_files end |
#extract ⇒ Object
14 15 16 |
# File 'lib/relaton/cli/relaton_file.rb', line 14 def extract extract_and_write_to_files end |
#split ⇒ Object
22 23 24 |
# File 'lib/relaton/cli/relaton_file.rb', line 22 def split split_and_write_to_files end |