Module: Hecks::Bluebook::Behaviour::Entity
- Includes:
- Identified, Indexed, Owns
- Included in:
- Entity
- Defined in:
- lib/hecks/bluebook/behaviour/entity.rb
Overview
WHAT AN ENTITY DOES. EXTENDED, not included — an entity is a CLASS, so this is singleton behaviour.
settle is the same seam an Aggregate has, reached from absorb
rather than from a constructor because a declared entity is built
by subclassing rather than by new. The traits are the same
ones, which is the whole point of them being traits: an entity's
identity is derived exactly as an aggregate's is, and was written
out twice before anyone could see that.
Instance Method Summary collapse
-
#entities ⇒ Object
S17, ADR 0026 —
@entities, now genuinely NESTED entities (Dispatch, inside Handler) rather than always[]. - #index_declarations ⇒ Object
- #settle ⇒ Object
-
#stamp_children ⇒ Object
A piece OWNS the verbs declared on it, so they can state an identity —
Banking::Account.Ledger.Depositrather than a command that cannot say what it belongs to.
Methods included from Owns
Methods included from Indexed
#attribute, #command, #index_attributes, #index_by_hecks_name, #query
Methods included from Identified
Instance Method Details
#entities ⇒ Object
S17, ADR 0026 — @entities, now genuinely NESTED entities
(Dispatch, inside Handler) rather than always []. Kept as a
real reader rather than a hardcoded empty list for two
reasons at once: Value::Coercion#for_attribute calls
.entities on WHATEVER OWNER it is handed — an aggregate's or
an entity's own — the moment it meets ANY list_of(...)
attribute (entity-typed or not — hydrate_entity_list's own
fallback, return value unless entity, only runs once
.entities has already answered) ; and EntityInterpreter
now walks a DOTTED chain of entities one level at a time
(walk_entity_chain) exactly the way an aggregate's own
.entities is walked for its direct children. Entity's own
header comment already promises it stays "structurally
interchangeable with an aggregate" for exactly this reason.
46 |
# File 'lib/hecks/bluebook/behaviour/entity.rb', line 46 def entities = @entities || [] |
#index_declarations ⇒ Object
26 27 28 29 30 |
# File 'lib/hecks/bluebook/behaviour/entity.rb', line 26 def index_declarations index_attributes(@attributes) @commands_by_name = index_by_hecks_name(@commands) @queries_by_name = index_by_hecks_name(@queries) end |
#settle ⇒ Object
20 21 22 23 24 |
# File 'lib/hecks/bluebook/behaviour/entity.rb', line 20 def settle derive_identity index_declarations self end |
#stamp_children ⇒ Object
A piece OWNS the verbs declared on it, so they can state an
identity — Banking::Account.Ledger.Deposit rather than a
command that cannot say what it belongs to. Separate from
settle because declare stamps AFTER absorbing, once the
subclass that will own them exists. @entities too now
(S17, ADR 0026) — a nested entity states its own owner chain
exactly the way a nested command does.
55 |
# File 'lib/hecks/bluebook/behaviour/entity.rb', line 55 def stamp_children = stamp(@commands, @queries, @entities) |