Class: Lutaml::UmlRepository::Exporters::Markdown::ClassPageBuilder

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

Instance Method Summary collapse

Methods included from Formatting

#format_cardinality, #format_stereotypes

Methods included from Lutaml::Uml::ModelHelpers

#class_type_for, #format_cardinality, #normalize_stereotypes, #package_path_for, #parse_cardinality, #qualified_name_for

Constructor Details

#initialize(repository, link_resolver) ⇒ ClassPageBuilder

Returns a new instance of ClassPageBuilder.



10
11
12
13
# File 'lib/lutaml/uml_repository/exporters/markdown/class_page_builder.rb', line 10

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

Instance Method Details

#build(klass, qname) ⇒ Object



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
42
43
44
# File 'lib/lutaml/uml_repository/exporters/markdown/class_page_builder.rb', line 15

def build(klass, qname)
  type = klass.class.name.split("::").last
  pkg_path = @link_resolver.extract_package_path(qname)

  <<~MARKDOWN
    # #{type}: #{klass.name}

    **Qualified Name**: `#{qname}`

    **Package**: [#{pkg_path}](#{@link_resolver.package_link(pkg_path)})

    #{build_stereotypes_section(klass)}

    #{build_definition_section(klass)}

    #{build_inheritance_section(klass)}

    #{build_attributes_section(klass)}

    #{build_operations_section(klass)}

    #{build_associations_section(klass)}

    #{build_enum_literals_section(klass)}

    ---

    [Back to Package](#{@link_resolver.package_link(pkg_path)}) | [Back to Index](../index.md)
  MARKDOWN
end