Class: Lutaml::Lml::Preprocessor
- Inherits:
-
Object
- Object
- Lutaml::Lml::Preprocessor
- Defined in:
- lib/lutaml/lml/preprocessor.rb
Instance Attribute Summary collapse
-
#input_file ⇒ Object
readonly
Returns the value of attribute input_file.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(input_file) ⇒ Preprocessor
constructor
A new instance of Preprocessor.
Constructor Details
#initialize(input_file) ⇒ Preprocessor
Returns a new instance of Preprocessor.
8 9 10 |
# File 'lib/lutaml/lml/preprocessor.rb', line 8 def initialize(input_file) @input_file = input_file end |
Instance Attribute Details
#input_file ⇒ Object (readonly)
Returns the value of attribute input_file.
6 7 8 |
# File 'lib/lutaml/lml/preprocessor.rb', line 6 def input_file @input_file end |
Class Method Details
.call(input_file) ⇒ Object
13 14 15 |
# File 'lib/lutaml/lml/preprocessor.rb', line 13 def call(input_file) new(input_file).call end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/lutaml/lml/preprocessor.rb', line 18 def call input_file.rewind include_root = input_file.is_a?(StringIO) ? Dir.pwd : File.dirname(input_file.path) input_file.read.split("\n").reduce([]) do |res, line| res.push(*process_dsl_line(include_root, line)) end.join("\n") end |