Class: Metanorma::Cli::Compiler
- Inherits:
-
Object
- Object
- Metanorma::Cli::Compiler
- Defined in:
- lib/metanorma/cli/compiler.rb
Class Method Summary collapse
Instance Method Summary collapse
- #compile ⇒ Array<String>
-
#initialize(file, options) ⇒ Compiler
constructor
A new instance of Compiler.
- #validate_file_path(file) ⇒ Object
Constructor Details
#initialize(file, options) ⇒ Compiler
Returns a new instance of Compiler.
7 8 9 10 11 12 |
# File 'lib/metanorma/cli/compiler.rb', line 7 def initialize(file, ) validate_file_path(file) @file = file = end |
Class Method Details
.compile(file, options) ⇒ Array<String>
37 38 39 |
# File 'lib/metanorma/cli/compiler.rb', line 37 def self.compile(file, ) new(file, ).compile end |
Instance Method Details
#compile ⇒ Array<String>
32 33 34 |
# File 'lib/metanorma/cli/compiler.rb', line 32 def compile compile_file end |
#validate_file_path(file) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/metanorma/cli/compiler.rb', line 14 def validate_file_path(file) path = Pathname.new(file) # Check if provided file path exists unless path.exist? raise ::Metanorma::Cli::Errors::FileNotFoundError.new( "Specified input file '#{file}' does not exist", ) end # Check if provided file is really a file unless path.file? raise ::Metanorma::Cli::Errors::FileNotFoundError.new( "Specified input file '#{file}' is not a file", ) end end |