Class: Metanorma::Compile::OutputFilenameConfig
- Inherits:
-
Object
- Object
- Metanorma::Compile::OutputFilenameConfig
- Defined in:
- lib/metanorma/compile/output_filename_config.rb
Constant Summary collapse
- DEFAULT_TEMPLATE =
"{{ document.docidentifier | downcase" \ " | replace: '/' , '-'" \ " | replace: ' ' , '-' }}"
Instance Attribute Summary collapse
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
- #generate_filename(relaton_data) ⇒ Object
-
#initialize(template) ⇒ OutputFilenameConfig
constructor
A new instance of OutputFilenameConfig.
Constructor Details
#initialize(template) ⇒ OutputFilenameConfig
Returns a new instance of OutputFilenameConfig.
13 14 15 16 17 18 19 |
# File 'lib/metanorma/compile/output_filename_config.rb', line 13 def initialize(template) @template = if template.nil? || template.empty? DEFAULT_TEMPLATE else template end end |
Instance Attribute Details
#template ⇒ Object (readonly)
Returns the value of attribute template.
11 12 13 |
# File 'lib/metanorma/compile/output_filename_config.rb', line 11 def template @template end |
Instance Method Details
#generate_filename(relaton_data) ⇒ Object
21 22 23 24 |
# File 'lib/metanorma/compile/output_filename_config.rb', line 21 def generate_filename(relaton_data) template = Liquid::Template.parse(@template) template.render("document" => relaton_data) end |