Class: Jazari::ResolvedRunbook
- Inherits:
-
Data
- Object
- Data
- Jazari::ResolvedRunbook
- Defined in:
- lib/jazari/resolved_runbook.rb
Overview
Every operation returns this. Never an unsaved ActiveRecord object.
Instance Attribute Summary collapse
-
#checklist ⇒ Object
readonly
Returns the value of attribute checklist.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#last_run ⇒ Object
readonly
Returns the value of attribute last_run.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#progress ⇒ Object
readonly
Returns the value of attribute progress.
-
#recipe ⇒ Object
readonly
Returns the value of attribute recipe.
-
#revision ⇒ Object
readonly
Returns the value of attribute revision.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#target_reference ⇒ Object
readonly
Returns the value of attribute target_reference.
-
#topic ⇒ Object
readonly
Returns the value of attribute topic.
Instance Method Summary collapse
- #custom? ⇒ Boolean
- #default? ⇒ Boolean
-
#diverged? ⇒ Boolean
Divergence someone chose: a row that exists, with nothing claiming to have manufactured it.
-
#inherited? ⇒ Boolean
custom?answers "does a row exist", which is not the same question as "did someone decide this". -
#initialize(state:, revision:, topic:, description:, checklist:, target_reference:, recipe:, last_run: nil, origin: nil) ⇒ ResolvedRunbook
constructor
A new instance of ResolvedRunbook.
Constructor Details
#initialize(state:, revision:, topic:, description:, checklist:, target_reference:, recipe:, last_run: nil, origin: nil) ⇒ ResolvedRunbook
Returns a new instance of ResolvedRunbook.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/jazari/resolved_runbook.rb', line 9 def initialize(state:, revision:, topic:, description:, checklist:, target_reference:, recipe:, last_run: nil, origin: nil) items = Checklist.freeze_items(checklist) super( state: state.freeze, revision: revision, topic: topic.freeze, description: description.freeze, checklist: items, progress: Checklist.progress(items).freeze, target_reference: target_reference.freeze, recipe: recipe.freeze, last_run: last_run.freeze, origin: origin&.freeze ) end |
Instance Attribute Details
#checklist ⇒ Object (readonly)
Returns the value of attribute checklist
5 6 7 |
# File 'lib/jazari/resolved_runbook.rb', line 5 def checklist @checklist end |
#description ⇒ Object (readonly)
Returns the value of attribute description
5 6 7 |
# File 'lib/jazari/resolved_runbook.rb', line 5 def description @description end |
#last_run ⇒ Object (readonly)
Returns the value of attribute last_run
5 6 7 |
# File 'lib/jazari/resolved_runbook.rb', line 5 def last_run @last_run end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin
5 6 7 |
# File 'lib/jazari/resolved_runbook.rb', line 5 def origin @origin end |
#progress ⇒ Object (readonly)
Returns the value of attribute progress
5 6 7 |
# File 'lib/jazari/resolved_runbook.rb', line 5 def progress @progress end |
#recipe ⇒ Object (readonly)
Returns the value of attribute recipe
5 6 7 |
# File 'lib/jazari/resolved_runbook.rb', line 5 def recipe @recipe end |
#revision ⇒ Object (readonly)
Returns the value of attribute revision
5 6 7 |
# File 'lib/jazari/resolved_runbook.rb', line 5 def revision @revision end |
#state ⇒ Object (readonly)
Returns the value of attribute state
5 6 7 |
# File 'lib/jazari/resolved_runbook.rb', line 5 def state @state end |
#target_reference ⇒ Object (readonly)
Returns the value of attribute target_reference
5 6 7 |
# File 'lib/jazari/resolved_runbook.rb', line 5 def target_reference @target_reference end |
#topic ⇒ Object (readonly)
Returns the value of attribute topic
5 6 7 |
# File 'lib/jazari/resolved_runbook.rb', line 5 def topic @topic end |
Instance Method Details
#custom? ⇒ Boolean
22 |
# File 'lib/jazari/resolved_runbook.rb', line 22 def custom? = state == "custom" |
#default? ⇒ Boolean
21 |
# File 'lib/jazari/resolved_runbook.rb', line 21 def default? = state == "default" |
#diverged? ⇒ Boolean
Divergence someone chose: a row that exists, with nothing claiming to have manufactured it.
36 |
# File 'lib/jazari/resolved_runbook.rb', line 36 def diverged? = custom? && origin.nil? |
#inherited? ⇒ Boolean
custom? answers "does a row exist", which is not the same question as
"did someone decide this". A backfill materializes a row for every subject
it touches, so a host reading custom? as divergence sees 100% divergence
the morning after a migration and learns nothing from it.
Comparing content against the canon does not separate them either: a backfilled runbook genuinely differs, because it carries the steps the subject actually had. Only provenance can, so only provenance is asked.
32 |
# File 'lib/jazari/resolved_runbook.rb', line 32 def inherited? = custom? && !origin.nil? |