Module: Hecks::Bluebook::Behaviour::Chapter
Overview
WHAT A CHAPTER DOES. The declared half is the roll-call of what a
bluebook holds; these are the finders over it, plus verbs — the
chapter's own list of every dispatchable name, which is derived
from the aggregates rather than declared anywhere.
Instance Method Summary collapse
-
#add_port(port) ⇒ Object
A PORT IS DECLARED IN THE HECKSAGON, not the bluebook — so it attaches after the chapter already exists, the same way an aggregate's own ports do.
- #aggregate(named) ⇒ Object
- #port(named) ⇒ Object
- #read_model(named) ⇒ Object
-
#settle ⇒ Object
THE HOOK THE GENERATED CONSTRUCTOR CALLS.
-
#verbs ⇒ Object
Every dispatchable name this chapter answers to, spelled exactly as Dispatcher#dispatch takes it.
Methods included from Owns
Instance Method Details
#add_port(port) ⇒ Object
A PORT IS DECLARED IN THE HECKSAGON, not the bluebook — so it attaches after the chapter already exists, the same way an aggregate's own ports do.
34 35 36 37 |
# File 'lib/hecks/bluebook/behaviour/chapter.rb', line 34 def add_port(port) @ports << port @ports_by_name[port.name] = port end |
#aggregate(named) ⇒ Object
27 |
# File 'lib/hecks/bluebook/behaviour/chapter.rb', line 27 def aggregate(named) = @aggregates.find { |a| a.name == named.to_s } |
#port(named) ⇒ Object
29 |
# File 'lib/hecks/bluebook/behaviour/chapter.rb', line 29 def port(named) = @ports_by_name[named.to_s] |
#read_model(named) ⇒ Object
28 |
# File 'lib/hecks/bluebook/behaviour/chapter.rb', line 28 def read_model(named) = @read_models.find { |model| model.name == named.to_s || model.query_name == named.to_s } |
#settle ⇒ Object
THE HOOK THE GENERATED CONSTRUCTOR CALLS. Three things a
declaration does not state: that a chapter is the ROOT of the
owner chain (nothing declares it, it is what having no owner
MEANS), the ports table — which a .hecksagon fills later, so
the bluebook cannot declare it — and stamping its own children,
the same act an Aggregate performs one level down.
19 20 21 22 23 24 25 |
# File 'lib/hecks/bluebook/behaviour/chapter.rb', line 19 def settle @hecks_root = true @ports = [] @ports_by_name = {} stamp(@aggregates, @read_models) self end |
#verbs ⇒ Object
Every dispatchable name this chapter answers to, spelled exactly as Dispatcher#dispatch takes it. Derived from the aggregates, never declared — which is why Projections::OIDC can hold its own scope list equal to this and have that mean something.
Recurses into entities, not just an aggregate's own direct
commands — Dispatcher#dispatch already routes a dotted
Domain::Aggregate.Entity.Command verb to EntityInterpreter
(a command_name with a "." in it), so a verb this method left
out was never "not a verb," only one this list forgot to name.
Ported from the same recursive shape spec/judge_coverage_spec.rb
already proved out for the meta-domain's own grammar (S17, ADR
0026) — entities nest arbitrarily deep (Dispatch, inside
Handler), so one flat level isn't enough.
53 54 55 |
# File 'lib/hecks/bluebook/behaviour/chapter.rb', line 53 def verbs @aggregates.flat_map { |agg| aggregate_verbs(agg) } end |