Class: Fontisan::Commands::MultiFormatOutput
- Inherits:
-
Object
- Object
- Fontisan::Commands::MultiFormatOutput
- Defined in:
- lib/fontisan/commands/multi_format_output.rb
Overview
Resolves the on-disk output path for each target format in a multi-format conversion (TODO 72).
Rules:
- One format + path has extension → use the path as-is.
- One format + path has no extension → append ".<format>".
- Many formats + path has extension → +ArgumentError+ (ambiguous).
- Many formats + path has no extension → append ".<format>" per target.
Pure value object: no I/O, no mutation. Extracted from ConvertCommand so multi-format path resolution can be tested independently of the transformation pipeline.
Instance Method Summary collapse
-
#initialize(base_path, target_formats) ⇒ MultiFormatOutput
constructor
A new instance of MultiFormatOutput.
-
#paths ⇒ Array<String>
One resolved path per target format, in the same order as
target_formats.
Constructor Details
#initialize(base_path, target_formats) ⇒ MultiFormatOutput
Returns a new instance of MultiFormatOutput.
20 21 22 23 |
# File 'lib/fontisan/commands/multi_format_output.rb', line 20 def initialize(base_path, target_formats) @base_path = base_path @target_formats = target_formats end |
Instance Method Details
#paths ⇒ Array<String>
Returns one resolved path per target format,
in the same order as target_formats.
28 29 30 |
# File 'lib/fontisan/commands/multi_format_output.rb', line 28 def paths single? ? [single_format_path] : multi_format_paths end |