Class: Hecks::Bluebook::Translation

Inherits:
Object
  • Object
show all
Defined in:
lib/hecks/bluebook/translation.rb

Overview

A declared map from one era of a domain's storage shape to the next. Renames and moves — the smallest slice that proves the concept: old records are translated when they are replayed, never rewritten. retired acknowledges aggregates that are gone outright — not renamed — so their disappearance is a decision, not an accident.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(domain:, from:, to:, aggregates: [], retired: []) ⇒ Translation

Returns a new instance of Translation.



81
82
83
84
85
86
87
# File 'lib/hecks/bluebook/translation.rb', line 81

def initialize(domain:, from:, to:, aggregates: [], retired: [])
  @domain     = domain.to_s
  @from       = from
  @to         = to
  @aggregates = aggregates
  @retired    = retired
end

Instance Attribute Details

#aggregatesObject (readonly)

Returns the value of attribute aggregates.



79
80
81
# File 'lib/hecks/bluebook/translation.rb', line 79

def aggregates
  @aggregates
end

#domainObject (readonly)

Returns the value of attribute domain.



79
80
81
# File 'lib/hecks/bluebook/translation.rb', line 79

def domain
  @domain
end

#fromObject (readonly)

Returns the value of attribute from.



79
80
81
# File 'lib/hecks/bluebook/translation.rb', line 79

def from
  @from
end

#retiredObject (readonly)

Returns the value of attribute retired.



79
80
81
# File 'lib/hecks/bluebook/translation.rb', line 79

def retired
  @retired
end

#toObject (readonly)

Returns the value of attribute to.



79
80
81
# File 'lib/hecks/bluebook/translation.rb', line 79

def to
  @to
end

Instance Method Details

#for_aggregate(name) ⇒ Object



89
# File 'lib/hecks/bluebook/translation.rb', line 89

def for_aggregate(name) = @aggregates.find { |aggregate| aggregate.name == name.to_s }