Class: Hecks::Bluebook::Chapter

Inherits:
Object
  • Object
show all
Includes:
Behaviour::Chapter, Construct, IR
Defined in:
lib/hecks/bluebook/chapter.rb

Overview

THE CHAPTER, and no longer the namespace it lives in.

Hecks::Bluebook was briefly a CLASS, because dropping the old IR:: segment would otherwise have produced Bluebook::Bluebook — a class shadowing its own enclosing module. Naming the construct what the code already called it everywhere (a chapter; this file was already chapter.rb) removes the clash at the source, so the namespace goes back to being a module.

Measured before changing: Bluebook was used AS a class in five places and as a namespace in seventy-seven files.

Constant Summary collapse

IR_VERSION =

THE SCHEMA'S OWN VERSION — not a domain's version: (Banking's "v1", a business fact the AUTHOR chose), but the shape to_h itself emits. A consumer reading exported IR with no Ruby DSL to cross-check against (a build-time generator, a stored snapshot) needs to know WHICH shape it's holding before it can safely interpret any of the rest of it. Bump this when to_h's own shape changes in a way a consumer would need to know about — not when a domain's own declarations change.

1

Instance Attribute Summary collapse

Attributes included from Construct

#hecks_name, #hecks_owner, #hecks_root

Instance Method Summary collapse

Methods included from IR

extended, included

Methods included from Behaviour::Chapter

#add_port, #aggregate, #port, #read_model, #settle, #verbs

Methods included from Behaviour::Owns

#stamp

Methods included from Construct

#hecks_fqn, #hecks_root?, #hecks_separator

Constructor Details

#initialize(name:, version: nil, vision: nil, aggregates: [], policies: [], process_managers: [], classification: nil, read_models: [], formerly_known_as: nil, attaches_to: []) ⇒ Chapter

Returns a new instance of Chapter.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/hecks/bluebook/chapter.rb', line 59

def initialize(name:, version: nil, vision: nil, aggregates: [], policies: [],
               process_managers: [], classification: nil, read_models: [], formerly_known_as: nil,
               attaches_to: [])
  @policies         = policies
  @process_managers = process_managers
  @name       = name.to_s
  @hecks_name = @name
  @hecks_root = true
  @version    = version&.to_s
  @vision     = vision
  @aggregates = aggregates
  @read_models = read_models
  @classification = classification&.to_s
  @formerly_known_as = formerly_known_as&.to_s
  @attaches_to = Array(attaches_to).map(&:to_s)
  settle
end

Instance Attribute Details

#aggregatesObject (readonly)

Returns the value of attribute aggregates.



56
57
58
# File 'lib/hecks/bluebook/chapter.rb', line 56

def aggregates
  @aggregates
end

#attaches_toObject (readonly)

Returns the value of attribute attaches_to.



56
57
58
# File 'lib/hecks/bluebook/chapter.rb', line 56

def attaches_to
  @attaches_to
end

#classificationObject (readonly)

Returns the value of attribute classification.



56
57
58
# File 'lib/hecks/bluebook/chapter.rb', line 56

def classification
  @classification
end

#formerly_known_asObject (readonly)

Returns the value of attribute formerly_known_as.



56
57
58
# File 'lib/hecks/bluebook/chapter.rb', line 56

def formerly_known_as
  @formerly_known_as
end

#nameObject (readonly)

Returns the value of attribute name.



56
57
58
# File 'lib/hecks/bluebook/chapter.rb', line 56

def name
  @name
end

#policiesObject (readonly)

Returns the value of attribute policies.



56
57
58
# File 'lib/hecks/bluebook/chapter.rb', line 56

def policies
  @policies
end

#portsObject (readonly)

Returns the value of attribute ports.



56
57
58
# File 'lib/hecks/bluebook/chapter.rb', line 56

def ports
  @ports
end

#process_managersObject (readonly)

Returns the value of attribute process_managers.



56
57
58
# File 'lib/hecks/bluebook/chapter.rb', line 56

def process_managers
  @process_managers
end

#read_modelsObject (readonly)

Returns the value of attribute read_models.



56
57
58
# File 'lib/hecks/bluebook/chapter.rb', line 56

def read_models
  @read_models
end

#versionObject (readonly)

Returns the value of attribute version.



56
57
58
# File 'lib/hecks/bluebook/chapter.rb', line 56

def version
  @version
end

#visionObject (readonly)

Returns the value of attribute vision.



56
57
58
# File 'lib/hecks/bluebook/chapter.rb', line 56

def vision
  @vision
end