Class: BlastRadius::Formatters::JsonFormatter

Inherits:
Base
  • Object
show all
Defined in:
lib/blast_radius/formatters/json_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) ⇒ String

Format dependency tree as JSON

Parameters:

  • root_node (Node)

    root node of dependency tree

Returns:

  • (String)

    JSON representation



11
12
13
# File 'lib/blast_radius/formatters/json_formatter.rb', line 11

def format(root_node)
  JSON.pretty_generate(node_to_hash(root_node))
end