Class: Hecks::Bluebook::ValueObject
- Inherits:
-
Object
- Object
- Hecks::Bluebook::ValueObject
- Extended by:
- Behaviour::ValueObject, Construct, IR
- Defined in:
- lib/hecks/bluebook/value_object.rb
Overview
A value object — a DECLARATION HOLDER, never instantiated.
ValueObjectBuilder returns an anonymous subclass whose singleton
carries the declaration : attributes, invariants, members. Nothing ever
calls .new on one — coercion builds Runtime::Value wrappers, and
invariants run as canonical text through the Evaluator. The runtime
reaches a shape through aggregate.value_object(name), the IR's own
finder ; there is no constant nesting and no second index.
to_h does not move. It is a byte-for-byte contract pinned by the
golden fixtures, so it keeps spelling the short declared name, which
is what hecks_name carries. DECLARATIONS IN THE GRAPH, STRINGS IN THE
EXPORT.
Class Attribute Summary collapse
-
.attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
.invariants ⇒ Object
readonly
Returns the value of attribute invariants.
-
.members ⇒ Object
readonly
Returns the value of attribute members.
Attributes included from Construct
#hecks_name, #hecks_owner, #hecks_root
Class Method Summary collapse
- .absorb(attributes:, invariants:, members:, closed_set:) ⇒ Object
-
.declare(name:, attributes: [], invariants: [], members: [], closed_set: !members.empty?)) ⇒ Object
One declared shape — a subclass rather than an instance, so the thing the bluebook declares and the thing Ruby holds are one object.
Methods included from Construct
hecks_fqn, hecks_root?, hecks_separator
Methods included from IR
Methods included from Behaviour::ValueObject
attribute, closed_set?, sole_attribute
Class Attribute Details
.attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
54 55 56 |
# File 'lib/hecks/bluebook/value_object.rb', line 54 def attributes @attributes end |
.invariants ⇒ Object (readonly)
Returns the value of attribute invariants.
54 55 56 |
# File 'lib/hecks/bluebook/value_object.rb', line 54 def invariants @invariants end |
.members ⇒ Object (readonly)
Returns the value of attribute members.
54 55 56 |
# File 'lib/hecks/bluebook/value_object.rb', line 54 def members @members end |
Class Method Details
.absorb(attributes:, invariants:, members:, closed_set:) ⇒ Object
66 67 68 69 70 71 |
# File 'lib/hecks/bluebook/value_object.rb', line 66 def absorb(attributes:, invariants:, members:, closed_set:) @attributes = attributes @invariants = invariants @members = members @closed_set = closed_set end |
.declare(name:, attributes: [], invariants: [], members: [], closed_set: !members.empty?)) ⇒ Object
One declared shape — a subclass rather than an instance, so the thing the bluebook declares and the thing Ruby holds are one object.
58 59 60 61 62 63 64 |
# File 'lib/hecks/bluebook/value_object.rb', line 58 def declare(name:, attributes: [], invariants: [], members: [], closed_set: !members.empty?) shape = Class.new(self) shape.hecks_name = name.to_s shape.absorb(attributes: attributes, invariants: invariants, members: members, closed_set: closed_set) shape end |