Class: Hecks::Runtime::CapabilityGraph
- Inherits:
-
Object
- Object
- Hecks::Runtime::CapabilityGraph
- Defined in:
- lib/hecks/runtime/capability_graph.rb
Overview
WHICH PORTS A BOOT CAN ACTUALLY FULFILL, read off the registry it already
holds. registry.ports names every port a domain declared a dependency
on ; registry.adapters names every adapter wired to implement one — the
same adapter.port == port.name match Ports::Extraction and
Ports::IdentityGeneration already make for themselves, one at a time,
each time they resolve. This is that same question asked once, for
every port at once, so a gap in the wiring is something a caller can ASK
about rather than something a live dispatch discovers by refusing.
cycles answers [], always, and honestly: nothing in this port model
lets one port depend on another — a port names a verb and a signal, an
adapter names the port it implements, and neither can point at a third
port. There is no edge for a cycle to be made of.
Instance Method Summary collapse
- #cycles ⇒ Object
-
#fulfillments ⇒ Object
{ port name => [adapter name, ...] }, for every port the registry declares — including the ports nothing implements, so a caller can tell "declared, unfulfilled" from "never declared at all".
-
#initialize(registry) ⇒ CapabilityGraph
constructor
A new instance of CapabilityGraph.
-
#unfulfilled ⇒ Object
The ports with zero adapters bound — the gap
Runtime::WiringErrorwould otherwise only surface at the moment something tries to dispatch through one.
Constructor Details
#initialize(registry) ⇒ CapabilityGraph
Returns a new instance of CapabilityGraph.
17 18 19 |
# File 'lib/hecks/runtime/capability_graph.rb', line 17 def initialize(registry) @registry = registry end |
Instance Method Details
#cycles ⇒ Object
35 |
# File 'lib/hecks/runtime/capability_graph.rb', line 35 def cycles = [] |
#fulfillments ⇒ Object
{ port name => [adapter name, ...] }, for every port the registry declares — including the ports nothing implements, so a caller can tell "declared, unfulfilled" from "never declared at all".
24 25 26 |
# File 'lib/hecks/runtime/capability_graph.rb', line 24 def fulfillments @fulfillments ||= @registry.ports.each_key.to_h { |name| [name, adapters_for(name)] } end |
#unfulfilled ⇒ Object
The ports with zero adapters bound — the gap Runtime::WiringError
would otherwise only surface at the moment something tries to dispatch
through one.
31 32 33 |
# File 'lib/hecks/runtime/capability_graph.rb', line 31 def unfulfilled fulfillments.select { |_, adapters| adapters.empty? }.keys end |