Class: Hecks::Bluebook::Assembly::AggregateAssembly
- Inherits:
-
Object
- Object
- Hecks::Bluebook::Assembly::AggregateAssembly
- Defined in:
- lib/hecks/bluebook/assembly/aggregate_assembly.rb
Overview
One head, built from its declaration.
The fields come from the contract like every other construct's. What is here is the part no field table can say: which construct holds which, and how a head's references become able to resolve.
It DECIDES NOTHING. Whether a declaration is admissible was settled on the way in, by the language.
Instance Method Summary collapse
- #aggregate ⇒ Object
-
#initialize(row) ⇒ AggregateAssembly
constructor
A new instance of AggregateAssembly.
Constructor Details
#initialize(row) ⇒ AggregateAssembly
Returns a new instance of AggregateAssembly.
13 14 15 |
# File 'lib/hecks/bluebook/assembly/aggregate_assembly.rb', line 13 def initialize(row) @row = row end |
Instance Method Details
#aggregate ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/hecks/bluebook/assembly/aggregate_assembly.rb', line 17 def aggregate shapes = Array(@row[:value_objects]).map { |shape| value_object(shape) } commands = Array(@row[:commands]).map { |verb| Build.call("Command", verb) } entities = Array(@row[:entities]).map { |piece| entity(piece) } asks = Array(@row[:queries]).map { |ask| Build.call("Query", ask) } fields = Array(@row[:attributes]).map { |field| Marks.attribute(field) } ir = Build.call( "Aggregate", @row, value_objects: shapes, commands: commands, entities: entities, queries: asks, lifecycle: lifecycle_of(@row), # A policy declared inside a head is HOISTED onto the chapter by the # builder, and `Aggregate#to_h` never carried it — so the language does # not record which head a chapter-level policy was written in. The # chapter holds them all, which is what `PolicyInterpreter` reads. policies: [], reference_targets: reference_targets(fields) ) stamp_references(ir) ir end |