Class: Hecks::Bluebook::MetaValidator::Judge

Inherits:
Object
  • Object
show all
Includes:
Readings
Defined in:
lib/hecks/bluebook/meta_validator/judge.rb

Overview

Offers every declaration in a built bluebook to the meta-domain.

This used to be one hand-written branch per category, and the cost of that shape was fourteen verbs the language declared and the judge never offered — among them Command.Argument and ValueObject.Field, so a command's own arguments and a value object's own fields were NEVER judged. Every rule hanging off them was decoration. Nothing went red, because a branch that does not exist cannot fail.

So there are no branches. The judge WALKS: it reads the plan the language makes of itself (Plan), and for each node offers the creating command, then each list through the command that appends to it, then each child. A verb in the plan with no offer is now impossible — there is no branch left in which to forget one, and spec/judge_coverage_spec holds it to that.

What is NOT uniform lives in Readings, and only where the IR's SHAPE differs from the language's. Naming differences do not appear at all: the language spells its fields as the IR spells them.

Only the DISPATCH half of the round trip lives here. Reconstruction is the experiment's business ; judging does not need it.

Constant Summary collapse

EAGER_CHILDREN =

Children offered BEFORE the parent's own lists, IN THIS ORDER. An attribute's type is offered as the id of the thing it names, so the value objects have to exist before anything that can name one — an aggregate's own attributes, AND an entity's own (M13: an entity is its own root, repeating the aggregate's whole shape one level down, so its attributes resolve against the SAME value-object pool). ValueObject first, Entity second, so an entity's own attributes are never offered before the value objects they may reference exist — a self-hosting casualty found live: the meta-grammar's own Handler/Dispatch/Member/ Keyword/Argument entities (S17, ADR 0026) failed reference resolution on their own plain value-object-typed attributes (HandlerText, MemberPosition, ...) the moment entity attributes started being checked at all, because @plan.names' own (incidental) declaration order happened to walk Entity first. The order is stated here, not left to whatever order the plan's own category table iterates in — see detail_node's own use of this constant, below.

{ "Aggregate" => %w[ValueObject Entity] }.freeze
WITHIN_ENTITY =

Categories an ENTITY declares as well as an aggregate. The IR reuses Command and Query for a piece's own commands and queries, so the language reuses Command and Query — and the plan cannot express a second parent, because a category's parent is derived from the one *_id argument its creating command carries. This says the other edge out loud.

%w[Command Query].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Readings

#closed_set_size, #compensates_with_spec_rows, #declared_name, #encode_literal, #field_value, #filter_options, #identity_rows, #mutation_rows, #normalisation_rows, #normalisation_table, #option_rows, #pair_rows, #parts, #points_at, #read_model_option_rows, #reference_type, #row_value, #rows_for, #set_row, #setter_value, #through, #transition_rows, #value_object_names, #where_rows, #with_spec_rows

Constructor Details

#initialize(bluebook) ⇒ Judge

Returns a new instance of Judge.



64
65
66
67
68
69
70
# File 'lib/hecks/bluebook/meta_validator/judge.rb', line 64

def initialize(bluebook)
  @bluebook = bluebook
  @refusals = []
  @runtime  = MetaValidator.fresh_runtime
  @plan     = Plan.for(MetaValidator.grammar_registry)
  judge!
end

Instance Attribute Details

#refusalsObject (readonly)

Returns the value of attribute refusals.



53
54
55
# File 'lib/hecks/bluebook/meta_validator/judge.rb', line 53

def refusals
  @refusals
end

#runtimeObject (readonly)

THE RECORDS SURVIVE THE VERDICT.

Judging a bluebook and HOLDING one differ by exactly this: whether anyone keeps the runtime the declarations were dispatched into. Nobody did, so spec/round_trip_spec reached the records by Judge.allocate and four instance_variable_set calls. Reading the chapter back is the point now, not a curiosity, so the runtime is simply readable.



62
63
64
# File 'lib/hecks/bluebook/meta_validator/judge.rb', line 62

def runtime
  @runtime
end