Class: Seafoam::Formatters::Json::DescribeFormatter
- Inherits:
-
Base::DescribeFormatter
- Object
- Base::DescribeFormatter
- Seafoam::Formatters::Json::DescribeFormatter
- Defined in:
- lib/seafoam/formatters/json.rb
Overview
A JSON-based formatter for the ‘describe` command.
Instance Attribute Summary
Attributes inherited from Base::DescribeFormatter
Instance Method Summary collapse
Methods inherited from Base::DescribeFormatter
Constructor Details
This class inherits a constructor from Seafoam::Formatters::Base::DescribeFormatter
Instance Method Details
#format ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/seafoam/formatters/json.rb', line 10 def format ret = Seafoam::Graal::GraphDescription::ATTRIBUTES.map { |attr| [attr, description.send(attr)] }.to_h ret[:node_count] = graph.nodes.values.count { |n| !n.props[:hidden] } ret[:node_counts] = description.sorted_node_counts ret.to_json end |