Class: Plumb::MetadataVisitor

Inherits:
Object
  • Object
show all
Includes:
VisitorHandlers
Defined in:
lib/plumb/metadata_visitor.rb

Overview

Collects user-provided metadata for a type (via #metadata, custom step metadata, and policy arguments). Any type-bound information (the expected Ruby types, patterns, ranges, static values, etc.) is intentionally NOT collected here — it is described by #input_type / #output_type instead.

Constant Summary

Constants included from VisitorHandlers

VisitorHandlers::NODE_NAME_FALLBACKS

Class Method Summary collapse

Instance Method Summary collapse

Methods included from VisitorHandlers

included, #visit, #visit_children, #visit_name

Class Method Details

.call(node) ⇒ Object



13
14
15
# File 'lib/plumb/metadata_visitor.rb', line 13

def self.call(node)
  new.visit(node)
end

Instance Method Details

#on_missing_handler(node, props, _method_name) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/plumb/metadata_visitor.rb', line 17

def on_missing_handler(node, props, _method_name)
  return props unless node.respond_to?(:children)

  node.children.reduce(props) do |acc, child|
    visit(child, acc)
  end
end