Class: Metanorma::Compile::OutputFilename
- Inherits:
-
Object
- Object
- Metanorma::Compile::OutputFilename
- Defined in:
- lib/metanorma/compile/output_filename.rb
Class Method Summary collapse
-
.from_filename(source_filename, output_dir = nil, processor = nil) ⇒ OutputFilename
Returns an instance of OutputFilename from the source filename.
Instance Method Summary collapse
-
#for_format(format) ⇒ String?
Returns the full file path name with the given format extension.
-
#initialize(noext_filename, output_dir = nil, processor = nil) ⇒ OutputFilename
constructor
The instance of OutputFilename.
-
#presentation_xml ⇒ String
Returns the full file path name with the presentation XML extension.
-
#semantic_xml ⇒ String
Returns the full file path name with the semantic XML extension.
-
#with_extension(ext) ⇒ String
Returns the full file path name with the given extension.
Constructor Details
#initialize(noext_filename, output_dir = nil, processor = nil) ⇒ OutputFilename
Returns the instance of OutputFilename.
27 28 29 30 31 |
# File 'lib/metanorma/compile/output_filename.rb', line 27 def initialize(noext_filename, output_dir = nil, processor = nil) @noext_filename = noext_filename @output_dir = output_dir @processor = processor end |
Class Method Details
.from_filename(source_filename, output_dir = nil, processor = nil) ⇒ OutputFilename
Returns an instance of OutputFilename from the source filename
11 12 13 |
# File 'lib/metanorma/compile/output_filename.rb', line 11 def self.from_filename(source_filename, output_dir = nil, processor = nil) new(strip_ext(source_filename), output_dir, processor) end |
Instance Method Details
#for_format(format) ⇒ String?
Returns the full file path name with the given format extension
48 49 50 51 |
# File 'lib/metanorma/compile/output_filename.rb', line 48 def for_format(format) ext = @processor&.output_formats&.[](format) ext ? with_extension(ext) : nil end |
#presentation_xml ⇒ String
Returns the full file path name with the presentation XML extension
41 42 43 |
# File 'lib/metanorma/compile/output_filename.rb', line 41 def presentation_xml with_extension("presentation.xml") end |
#semantic_xml ⇒ String
Returns the full file path name with the semantic XML extension
35 36 37 |
# File 'lib/metanorma/compile/output_filename.rb', line 35 def semantic_xml with_extension("xml") end |
#with_extension(ext) ⇒ String
Returns the full file path name with the given extension
56 57 58 59 |
# File 'lib/metanorma/compile/output_filename.rb', line 56 def with_extension(ext) file = change_output_dir "#{file}.#{ext}" end |