Class: Metasploit::ERD::Diagram

Inherits:
RailsERD::Diagram::Graphviz
  • Object
show all
Defined in:
lib/metasploit/erd/diagram.rb

Overview

A diagram specialized with default options that work well with Clusterable#domain.

Constant Summary collapse

ATTRIBUTES =

Enable all attributes

[
    :content,
    :foreign_keys,
    :primary_keys,
    :timestamps
]
FILETYPE =

File type that work for embedding in web pages and is lossless.

:png
INDIRECT =

Only show direct relationships because anything indirect can be found by tracing the direct arrows and only showing direct relationships cuts down on cluster

false
INHERITANCE =

Show inheritance for Single Table Inheritance

true
NOTATION =

Use crowsfoot notation since its what metasploit uses for manually drawn and graffle diagrams.

:crowsfoot
POLYMORPHISM =

Show polymorphic association connections as they are traced by Relationship#polymorphic_class_set.

true
DEFAULT_OPTIONS =

Default options for #initialize

{
    attributes: ATTRIBUTES,
    filetype: FILETYPE,
    indirect: INDIRECT,
    inheritance: INHERITANCE,
    notation: NOTATION,
    polymorphism: POLYMORPHISM
}

Instance Method Summary collapse

Constructor Details

#initialize(domain, options = {}) ⇒ Diagram

Returns a new instance of Diagram.

Parameters:

  • domain (RailsERD::Domain)

    domain to diagram

  • options (Hash{Symbol => Object}) (defaults to: {})

    options controlling what to include from domain and how to render diagram. Defaults to DEFAULT_OPTIONS.

Options Hash (options):

  • :attributes (Array<Symbol>) — default: ATTRIBUTES

    attributes of each entity (table) to include in the diagram.

  • :filetype (String, Symbol) — default: FILETYPE

    the file type of the generated diagram. Supported formats depend on formats supported by graphviz installation.

  • :indirect (Boolean) — default: INDIRECT

    Whether to include indirect (has_many through:) relationships.

  • :inheritance (Boolean) — default: INHERITANCE

    Whether to include Single Table Inheritance (STI) subclass entities.

  • :notation (Symbol) — default: NOTATION

    The cardinality notation to be used. Refer to RailsERD documentation for availble notations.

  • :orientation (:horizontal, :vertical) — default: :horizontal

    The directory of the hierarchy of entities.

  • :polymorphism (Boolean) — default: POLYMORPHISM

    Whether to include abstract or polymorphic pseudo-entities.

  • :title (String)

    Title for diagram.



84
85
86
87
88
# File 'lib/metasploit/erd/diagram.rb', line 84

def initialize(domain, options={})
  super_options = DEFAULT_OPTIONS.merge(options)

  super(domain, super_options)
end