Class: Lutaml::UmlRepository::Exporters::BaseExporter

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/uml_repository/exporters/base_exporter.rb

Overview

Base class for all exporters.

Exporters convert a UmlRepository to various formats such as CSV, JSON, Markdown, etc. All exporters inherit from this base class and implement the [‘export`](#export) method.

Examples:

Creating a custom exporter

class MyExporter < BaseExporter
  def export(output_path, options = {})
    # Implementation here
  end
end

exporter = MyExporter.new(repository)
exporter.export("output.txt")

Direct Known Subclasses

JsonExporter, MarkdownExporter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository) ⇒ BaseExporter

Initialize a new exporter.

Parameters:



28
29
30
# File 'lib/lutaml/uml_repository/exporters/base_exporter.rb', line 28

def initialize(repository)
  @repository = repository
end

Instance Attribute Details

#repositoryUmlRepository (readonly)

Returns The repository to export.

Returns:



23
24
25
# File 'lib/lutaml/uml_repository/exporters/base_exporter.rb', line 23

def repository
  @repository
end

Instance Method Details

#export(output_path, options = {}) ⇒ void

This method returns an undefined value.

Export the repository to a file.

Parameters:

  • output_path (String)

    Path to the output file

  • options (Hash) (defaults to: {})

    Export options (exporter-specific)

Raises:

  • (NotImplementedError)

    Must be implemented by subclasses



38
39
40
41
# File 'lib/lutaml/uml_repository/exporters/base_exporter.rb', line 38

def export(output_path, options = {})
  raise NotImplementedError,
        "#{self.class.name} must implement #export"
end