Class: BlastRadius::Formatters::HtmlFormatter

Inherits:
Base
  • Object
show all
Defined in:
lib/blast_radius/formatters/html_formatter.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from BlastRadius::Formatters::Base

Instance Method Details

#format(root_node, options = {}) ⇒ String

Format dependency tree as interactive HTML ER diagram

Parameters:

  • root_node (Node)

    root node of dependency tree

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

    formatting options

    • :all_models [Boolean] include all models in ER diagram (default: true)
    • :title [String] custom title
    • :theme [Symbol] :light, :dark, or :auto (default: :auto)

Returns:

  • (String)

    HTML representation



16
17
18
19
20
21
22
23
24
# File 'lib/blast_radius/formatters/html_formatter.rb', line 16

def format(root_node, options = {})
  @root_node = root_node
  @options = options
  @all_models = discover_all_models

  template_content = File.read(template_path)
  erb = ERB.new(template_content)
  erb.result(binding)
end