Class: Seafoam::Annotators::FallbackAnnotator
- Inherits:
-
Seafoam::Annotator
- Object
- Seafoam::Annotator
- Seafoam::Annotators::FallbackAnnotator
- Defined in:
- lib/seafoam/annotators/fallback.rb
Overview
The fallback annotator always applies, and adds some basic annotations. Works for example with Truffle AST and call graphs, but also means anyone can emit a graph with ‘label’ properties and we can do something useful with it.
Constant Summary
Constants inherited from Seafoam::Annotator
Seafoam::Annotator::SUBCLASSES
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Seafoam::Annotator
#applies?, inherited, #initialize
Constructor Details
This class inherits a constructor from Seafoam::Annotator
Class Method Details
.applies?(_graph) ⇒ Boolean
8 9 10 |
# File 'lib/seafoam/annotators/fallback.rb', line 8 def self.applies?(_graph) true end |
Instance Method Details
#annotate(graph) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/seafoam/annotators/fallback.rb', line 12 def annotate(graph) graph.nodes.each_value do |node| if node.props[:label].nil? && node.props['label'] node.props[:label] = node.props['label'] end node.props[:kind] ||= 'other' end graph.edges.each do |edge| edge.props[:kind] ||= 'other' end end |