Class: Lutaml::Formatter::Graphviz

Inherits:
Base
  • Object
show all
Includes:
DocumentFormatter, HtmlBuilder, NodeFormatter, RelationshipFormatter
Defined in:
lib/lutaml/lml/formatter/graphviz.rb,
lib/lutaml/lml/formatter/graphviz/html_builder.rb,
lib/lutaml/lml/formatter/graphviz/node_formatter.rb,
lib/lutaml/lml/formatter/graphviz/document_formatter.rb,
lib/lutaml/lml/formatter/graphviz/relationship_formatter.rb

Defined Under Namespace

Modules: DocumentFormatter, HtmlBuilder, NodeFormatter, RelationshipFormatter Classes: Attributes

Constant Summary collapse

DEFAULT_CLASS_FONT =
'Helvetica'
VALID_TYPES =
%i[
  dot xdot ps pdf svg svgz fig png gif jpg jpeg json imap cmapx
].freeze

Constants included from RelationshipFormatter

RelationshipFormatter::ARROW_TYPES, RelationshipFormatter::DASHED_TYPES, RelationshipFormatter::DIRECTION_LABELS

Constants included from NodeFormatter

NodeFormatter::ACCESS_SYMBOLS

Constants included from HtmlBuilder

HtmlBuilder::EMPTY_MEMBER_TABLE

Constants inherited from Base

Base::FORMAT_HANDLERS

Instance Attribute Summary collapse

Attributes inherited from Base

#type

Instance Method Summary collapse

Methods included from DocumentFormatter

#build_associations, #build_digraph, #collect_all_associations, #extract_fidelity_options, #format_all_classes, #format_document, #format_filtered_associations, #indent_lines

Methods included from RelationshipFormatter

#build_edge_attributes, #format_label, #format_relationship

Methods included from NodeFormatter

#format_attribute, #format_cardinality_bounds, #format_class, #format_enum_literal, #format_operation, #format_operation_params

Methods included from HtmlBuilder

#build_member_table, #build_name_table, #build_table_body, #enum_literal?, #escape_html_chars, #format_enum_member, #format_member_rows

Methods inherited from Base

#dispatch_format, format, #format_attribute, #format_class, #format_document, #format_operation, #format_relationship, inherited, name, #name

Methods included from Lml::HasAttributes

#update_attributes

Constructor Details

#initialize(attributes = {}) ⇒ Graphviz

Returns a new instance of Graphviz.



34
35
36
37
38
# File 'lib/lutaml/lml/formatter/graphviz.rb', line 34

def initialize(attributes = {})
  super
  setup_default_attributes
  @type = :dot
end

Instance Attribute Details

#edgeObject (readonly)

Returns the value of attribute edge.



40
41
42
# File 'lib/lutaml/lml/formatter/graphviz.rb', line 40

def edge
  @edge
end

#graphObject (readonly)

Returns the value of attribute graph.



40
41
42
# File 'lib/lutaml/lml/formatter/graphviz.rb', line 40

def graph
  @graph
end

#nodeObject (readonly)

Returns the value of attribute node.



40
41
42
# File 'lib/lutaml/lml/formatter/graphviz.rb', line 40

def node
  @node
end

Instance Method Details

#format(node) ⇒ Object



47
48
49
50
# File 'lib/lutaml/lml/formatter/graphviz.rb', line 47

def format(node)
  dot = super.lines.map(&:rstrip).join("\n")
  generate_from_dot(dot)
end

#type=(value) ⇒ Object



42
43
44
45
# File 'lib/lutaml/lml/formatter/graphviz.rb', line 42

def type=(value)
  super
  @type = :dot unless VALID_TYPES.include?(@type)
end