Module: Suma::LinkValidator::Step

Defined in:
lib/suma/link_validator/step.rb

Overview

Per-node-type navigation strategies for validate_deep_path.

Each Step handles one EXPRESS construct (entity, type, ...) and knows how to walk one path segment from it. The dispatcher in LinkValidator picks the right Step by handles?.

Adding a new navigable construct means adding a new Step class and registering it in REGISTRY — no edits to existing Steps or to validate_deep_path (open/closed principle).

Defined Under Namespace

Modules: Failure, SchemaElementLookup Classes: Context, Entity, Type

Constant Summary collapse

REGISTRY =
[Entity, Type].freeze

Class Method Summary collapse

Class Method Details

.for(node) ⇒ Object

Returns the Step class that handles node, or nil if no registered Step matches.



144
145
146
# File 'lib/suma/link_validator/step.rb', line 144

def self.for(node)
  REGISTRY.find { |step| step.handles?(node) }
end