Class: Rigor::FlowContribution::MergeResult
- Inherits:
-
Object
- Object
- Rigor::FlowContribution::MergeResult
- Defined in:
- lib/rigor/flow_contribution/merge_result.rb
Overview
Result of folding any number of Rigor::FlowContribution bundles through Rigor::FlowContribution::Merger.merge. Surfaces the merged content slot-by- slot, the ordered list of contributing provenances, and the Conflict list collected along the way.
The merge result is a sibling shape of Rigor::FlowContribution —the analyzer reads from it to drive narrowing / dispatch / diagnostics, and the formatter reads from it to surface plugin / RBS::Extended provenance. The shape is derived per ADR-2 § “Plugin Contribution Merging”; see [‘docs/internal-spec/flow-contribution-merger.md`](../../../docs/internal-spec/flow-contribution-merger.md) for the slice-3 normative description.
Instance Attribute Summary collapse
-
#conflicts ⇒ Object
readonly
Returns the value of attribute conflicts.
-
#exceptional ⇒ Object
readonly
Returns the value of attribute exceptional.
-
#falsey_facts ⇒ Object
readonly
Returns the value of attribute falsey_facts.
-
#invalidations ⇒ Object
readonly
Returns the value of attribute invalidations.
-
#mutations ⇒ Object
readonly
Returns the value of attribute mutations.
-
#post_return_facts ⇒ Object
readonly
Returns the value of attribute post_return_facts.
-
#provenances ⇒ Object
readonly
Returns the value of attribute provenances.
-
#return_type ⇒ Object
readonly
Returns the value of attribute return_type.
-
#role_conformance ⇒ Object
readonly
Returns the value of attribute role_conformance.
-
#truthy_facts ⇒ Object
readonly
Returns the value of attribute truthy_facts.
Instance Method Summary collapse
- #conflict? ⇒ Boolean
-
#empty? ⇒ Boolean
rubocop:disable Metrics/CyclomaticComplexity.
-
#initialize(return_type: nil, truthy_facts: [], falsey_facts: [], post_return_facts: [], mutations: [], invalidations: [], exceptional: nil, role_conformance: [], provenances: [], conflicts: []) ⇒ MergeResult
constructor
rubocop:disable Metrics/ParameterLists.
- #to_h ⇒ Object
Constructor Details
#initialize(return_type: nil, truthy_facts: [], falsey_facts: [], post_return_facts: [], mutations: [], invalidations: [], exceptional: nil, role_conformance: [], provenances: [], conflicts: []) ⇒ MergeResult
rubocop:disable Metrics/ParameterLists
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rigor/flow_contribution/merge_result.rb', line 23 def initialize(return_type: nil, truthy_facts: [], falsey_facts: [], post_return_facts: [], mutations: [], invalidations: [], exceptional: nil, role_conformance: [], provenances: [], conflicts: []) # rubocop:enable Metrics/ParameterLists @return_type = return_type @truthy_facts = truthy_facts.dup.freeze @falsey_facts = falsey_facts.dup.freeze @post_return_facts = post_return_facts.dup.freeze @mutations = mutations.dup.freeze @invalidations = invalidations.dup.freeze @exceptional = exceptional @role_conformance = role_conformance.dup.freeze @provenances = provenances.dup.freeze @conflicts = conflicts.dup.freeze freeze end |
Instance Attribute Details
#conflicts ⇒ Object (readonly)
Returns the value of attribute conflicts.
18 19 20 |
# File 'lib/rigor/flow_contribution/merge_result.rb', line 18 def conflicts @conflicts end |
#exceptional ⇒ Object (readonly)
Returns the value of attribute exceptional.
18 19 20 |
# File 'lib/rigor/flow_contribution/merge_result.rb', line 18 def exceptional @exceptional end |
#falsey_facts ⇒ Object (readonly)
Returns the value of attribute falsey_facts.
18 19 20 |
# File 'lib/rigor/flow_contribution/merge_result.rb', line 18 def falsey_facts @falsey_facts end |
#invalidations ⇒ Object (readonly)
Returns the value of attribute invalidations.
18 19 20 |
# File 'lib/rigor/flow_contribution/merge_result.rb', line 18 def invalidations @invalidations end |
#mutations ⇒ Object (readonly)
Returns the value of attribute mutations.
18 19 20 |
# File 'lib/rigor/flow_contribution/merge_result.rb', line 18 def mutations @mutations end |
#post_return_facts ⇒ Object (readonly)
Returns the value of attribute post_return_facts.
18 19 20 |
# File 'lib/rigor/flow_contribution/merge_result.rb', line 18 def post_return_facts @post_return_facts end |
#provenances ⇒ Object (readonly)
Returns the value of attribute provenances.
18 19 20 |
# File 'lib/rigor/flow_contribution/merge_result.rb', line 18 def provenances @provenances end |
#return_type ⇒ Object (readonly)
Returns the value of attribute return_type.
18 19 20 |
# File 'lib/rigor/flow_contribution/merge_result.rb', line 18 def return_type @return_type end |
#role_conformance ⇒ Object (readonly)
Returns the value of attribute role_conformance.
18 19 20 |
# File 'lib/rigor/flow_contribution/merge_result.rb', line 18 def role_conformance @role_conformance end |
#truthy_facts ⇒ Object (readonly)
Returns the value of attribute truthy_facts.
18 19 20 |
# File 'lib/rigor/flow_contribution/merge_result.rb', line 18 def truthy_facts @truthy_facts end |
Instance Method Details
#conflict? ⇒ Boolean
41 42 43 |
# File 'lib/rigor/flow_contribution/merge_result.rb', line 41 def conflict? !@conflicts.empty? end |
#empty? ⇒ Boolean
rubocop:disable Metrics/CyclomaticComplexity
45 46 47 48 49 |
# File 'lib/rigor/flow_contribution/merge_result.rb', line 45 def empty? # rubocop:disable Metrics/CyclomaticComplexity @return_type.nil? && @truthy_facts.empty? && @falsey_facts.empty? && @post_return_facts.empty? && @mutations.empty? && @invalidations.empty? && @exceptional.nil? && @role_conformance.empty? end |
#to_h ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/rigor/flow_contribution/merge_result.rb', line 51 def to_h { "return_type" => return_type, "truthy_facts" => truthy_facts, "falsey_facts" => falsey_facts, "post_return_facts" => post_return_facts, "mutations" => mutations, "invalidations" => invalidations, "exceptional" => exceptional, "role_conformance" => role_conformance, "provenances" => provenances.map { |p| p.respond_to?(:to_h) ? p.to_h : p }, "conflicts" => conflicts.map(&:to_h) } end |