Class: Seafoam::Formatters::Text::DescribeFormatter

Inherits:
Base::DescribeFormatter show all
Defined in:
lib/seafoam/formatters/text.rb

Overview

A plain-text formatter for the ‘describe` command.

Instance Attribute Summary

Attributes inherited from Base::DescribeFormatter

#description, #graph

Instance Method Summary collapse

Methods inherited from Base::DescribeFormatter

#initialize

Constructor Details

This class inherits a constructor from Seafoam::Formatters::Base::DescribeFormatter

Instance Method Details

#formatObject



8
9
10
11
12
13
14
# File 'lib/seafoam/formatters/text.rb', line 8

def format
  notes = Seafoam::Graal::GraphDescription::ATTRIBUTES.select { |attr| description.send(attr) }
  unhidden_count = graph.nodes.values.count { |n| !n.props[:hidden] }
  node_counts = description.sorted_node_counts.map { |node_class, count| "#{node_class}: #{count}" }.join("\n")

  ["#{unhidden_count} nodes", *notes].join(", ") + "\n#{node_counts}"
end