Class: Lutaml::Uml::Parsers::DslPreprocessor
- Inherits:
-
Object
- Object
- Lutaml::Uml::Parsers::DslPreprocessor
- Defined in:
- lib/lutaml/uml/parsers/dsl_preprocessor.rb
Overview
Class for preprocessing dsl ascii file special directives:
-
include
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) ⇒ DslPreprocessor
constructor
A new instance of DslPreprocessor.
Constructor Details
#initialize(input_file) ⇒ DslPreprocessor
Returns a new instance of DslPreprocessor.
11 12 13 |
# File 'lib/lutaml/uml/parsers/dsl_preprocessor.rb', line 11 def initialize(input_file) @input_file = input_file end |
Instance Attribute Details
#input_file ⇒ Object (readonly)
Returns the value of attribute input_file.
9 10 11 |
# File 'lib/lutaml/uml/parsers/dsl_preprocessor.rb', line 9 def input_file @input_file end |
Class Method Details
.call(input_file) ⇒ Object
16 17 18 |
# File 'lib/lutaml/uml/parsers/dsl_preprocessor.rb', line 16 def call(input_file) new(input_file).call end |
Instance Method Details
#call ⇒ Object
21 22 23 24 25 26 |
# File 'lib/lutaml/uml/parsers/dsl_preprocessor.rb', line 21 def call include_root = 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 |