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.
8 9 10 11 12 13 |
# File 'lib/metanorma/cli/compiler.rb', line 8 def initialize(file, ) validate_file_path(file) @file = file @options = end |
Class Method Details
.compile(file, options) ⇒ Array<String>
34 35 36 |
# File 'lib/metanorma/cli/compiler.rb', line 34 def self.compile(file, ) new(file, ).compile end |
Instance Method Details
#compile ⇒ Array<String>
29 30 31 |
# File 'lib/metanorma/cli/compiler.rb', line 29 def compile compile_file end |
#validate_file_path(file) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/metanorma/cli/compiler.rb', line 15 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 |