Class: Lutaml::UmlRepository::Exporters::Markdown::IndexPageBuilder

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

Instance Method Summary collapse

Constructor Details

#initialize(repository, options, link_resolver) ⇒ IndexPageBuilder

Returns a new instance of IndexPageBuilder.



8
9
10
11
12
# File 'lib/lutaml/uml_repository/exporters/markdown/index_page_builder.rb', line 8

def initialize(repository, options, link_resolver)
  @repository = repository
  @options = options
  @link_resolver = link_resolver
end

Instance Method Details

#buildObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/lutaml/uml_repository/exporters/markdown/index_page_builder.rb', line 14

def build
  title = @options.fetch(:title, "UML Model Documentation")
  stats = @repository.statistics

  <<~MARKDOWN
    # #{title}

    ## Overview

    This documentation provides comprehensive information about the UML model.

    ## Statistics

    - **Total Packages**: #{stats&.dig(:total_packages) || 0}
    - **Total Classes**: #{stats&.dig(:total_classes) || 0}
    - **Total Associations**: #{stats&.dig(:total_associations) || 0}
    - **Total Diagrams**: #{stats&.dig(:total_diagrams) || 0}

    ## Package Structure

    #{build_package_tree_markdown}

    ## Navigation

    - [Packages](packages/)
    - [Classes](classes/)
  MARKDOWN
end