Class: Hecks::Bluebook::Attribute

Inherits:
Object
  • Object
show all
Includes:
Behaviour::Attribute, IR
Defined in:
lib/hecks/bluebook/attribute.rb

Constant Summary collapse

PRIMITIVES =

Held because a declared vocabulary pins it — spec/vocabulary_conformance holds Primitive's members to this list. The primitive? predicate that used to read it had no caller anywhere and is gone.

Hecks::Vocabulary.fetch("Primitive")

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Behaviour::Attribute

#list?, #optional?, #reference?, #scalar?

Methods included from IR

extended, included

Constructor Details

#initialize(name:, type:, list: false, default: nil, optional: false, pattern: nil, admits: nil, relationship: nil) ⇒ Attribute

A Reference is kept AS ITSELF. Every other type is still a name, and crosses over as its construct does.

admits names an ALREADY-DECLARED closed set the value must belong to — Vocabulary::QueryComparator — spelled aggregate-qualified because the set is a value object INSIDE an aggregate, and the aggregate is the only thing reference_to can reach.

ON THE WIRE, because it is a RULE and not only a typing hint.

It began as neither. The link existed so a generator could type WhereClause.op as WhereOp — a typing convenience, not worth moving 710 attribute records across eight goldens for. Then admits grew teeth (coercion refuses a non-member) and the argument inverted: a rule the wire does not carry is one a reader of the IR cannot enforce, and a bluebook whose meaning depends on the reader means two things. Proved rather than assumed — the same domain refused "burnt" through one reading and emitted the event through another.

The wire carries the NAME, not the members. A reader resolves it against the IR it holds, so the members are declared once and copied nowhere — which is the same reason admits exists at all.



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/hecks/bluebook/attribute.rb', line 48

def initialize(name:, type:, list: false, default: nil, optional: false, pattern: nil,
               admits: nil, relationship: nil)
  @name     = name.to_sym
  @type     = spell(type)
  @list     = list
  @default  = default
  @optional = optional
  @pattern  = pattern
  @admits   = admits&.to_s
  @relationship = relationship&.to_s
end

Instance Attribute Details

#admitsObject (readonly)

Returns the value of attribute admits.



23
24
25
# File 'lib/hecks/bluebook/attribute.rb', line 23

def admits
  @admits
end

#defaultObject (readonly)

Returns the value of attribute default.



23
24
25
# File 'lib/hecks/bluebook/attribute.rb', line 23

def default
  @default
end

#nameObject (readonly)

Returns the value of attribute name.



23
24
25
# File 'lib/hecks/bluebook/attribute.rb', line 23

def name
  @name
end

#patternObject (readonly)

Returns the value of attribute pattern.



23
24
25
# File 'lib/hecks/bluebook/attribute.rb', line 23

def pattern
  @pattern
end

#relationshipObject (readonly)

Returns the value of attribute relationship.



23
24
25
# File 'lib/hecks/bluebook/attribute.rb', line 23

def relationship
  @relationship
end

#typeObject (readonly)

Returns the value of attribute type.



23
24
25
# File 'lib/hecks/bluebook/attribute.rb', line 23

def type
  @type
end