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. An attribute's type is offered as the id of the thing it names, so both the value objects and the entities have to exist before any attribute names one.

{ "Aggregate" => %w[Entity ValueObject] }.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, #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.



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

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.



40
41
42
# File 'lib/hecks/bluebook/meta_validator/judge.rb', line 40

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.



49
50
51
# File 'lib/hecks/bluebook/meta_validator/judge.rb', line 49

def runtime
  @runtime
end