Class: Ast::Merge::SourceRender::ConflictFragment
- Inherits:
-
Object
- Object
- Ast::Merge::SourceRender::ConflictFragment
- Defined in:
- lib/ast/merge/source_render/fragment.rb,
sig/ast/merge.rbs
Overview
Localized base/ours/theirs alternatives selected by a provider.
Constant Summary collapse
- DEFAULT_MARKER_SIZE =
7
Instance Attribute Summary collapse
-
#base ⇒ Array[SourceFragment | SynthesizedFragment]
readonly
Returns the value of attribute base.
-
#conflict_id ⇒ String
readonly
Returns the value of attribute conflict_id.
-
#labels ⇒ Hash[Symbol, String]
readonly
Returns the value of attribute labels.
-
#marker_size ⇒ Integer
readonly
Returns the value of attribute marker_size.
-
#metadata ⇒ Hash[untyped, untyped]
readonly
Returns the value of attribute metadata.
-
#ours ⇒ Array[SourceFragment | SynthesizedFragment]
readonly
Returns the value of attribute ours.
-
#theirs ⇒ Array[SourceFragment | SynthesizedFragment]
readonly
Returns the value of attribute theirs.
Instance Method Summary collapse
- #children_for(side) ⇒ Array[SourceFragment | SynthesizedFragment]
-
#initialize(conflict_id:, base:, ours:, theirs:, labels: {}, marker_size: DEFAULT_MARKER_SIZE, metadata: {}) ⇒ ConflictFragment
constructor
rubocop:disable Metrics/ParameterLists -- three semantic sides are explicit contract roles.
-
#kind ⇒ :conflict
rubocop:enable Metrics/ParameterLists.
Constructor Details
#initialize(conflict_id:, base:, ours:, theirs:, labels: {}, marker_size: DEFAULT_MARKER_SIZE, metadata: {}) ⇒ ConflictFragment
rubocop:disable Metrics/ParameterLists -- three semantic sides are explicit contract roles
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/ast/merge/source_render/fragment.rb', line 70 def initialize(conflict_id:, base:, ours:, theirs:, labels: {}, marker_size: DEFAULT_MARKER_SIZE, metadata: {}) @conflict_id = conflict_id.to_s.freeze @base = normalize_children(base) @ours = normalize_children(ours) @theirs = normalize_children(theirs) @labels = default_labels.merge(symbolize_keys(labels)).freeze @marker_size = Integer(marker_size) @metadata = .to_h.freeze validate! end |
Instance Attribute Details
#base ⇒ Array[SourceFragment | SynthesizedFragment] (readonly)
Returns the value of attribute base.
67 68 69 |
# File 'lib/ast/merge/source_render/fragment.rb', line 67 def base @base end |
#conflict_id ⇒ String (readonly)
Returns the value of attribute conflict_id.
67 68 69 |
# File 'lib/ast/merge/source_render/fragment.rb', line 67 def conflict_id @conflict_id end |
#labels ⇒ Hash[Symbol, String] (readonly)
Returns the value of attribute labels.
67 68 69 |
# File 'lib/ast/merge/source_render/fragment.rb', line 67 def labels @labels end |
#marker_size ⇒ Integer (readonly)
Returns the value of attribute marker_size.
67 68 69 |
# File 'lib/ast/merge/source_render/fragment.rb', line 67 def marker_size @marker_size end |
#metadata ⇒ Hash[untyped, untyped] (readonly)
Returns the value of attribute metadata.
67 68 69 |
# File 'lib/ast/merge/source_render/fragment.rb', line 67 def @metadata end |
#ours ⇒ Array[SourceFragment | SynthesizedFragment] (readonly)
Returns the value of attribute ours.
67 68 69 |
# File 'lib/ast/merge/source_render/fragment.rb', line 67 def ours @ours end |
#theirs ⇒ Array[SourceFragment | SynthesizedFragment] (readonly)
Returns the value of attribute theirs.
67 68 69 |
# File 'lib/ast/merge/source_render/fragment.rb', line 67 def theirs @theirs end |
Instance Method Details
#children_for(side) ⇒ Array[SourceFragment | SynthesizedFragment]
87 88 89 |
# File 'lib/ast/merge/source_render/fragment.rb', line 87 def children_for(side) public_send(side) end |
#kind ⇒ :conflict
rubocop:enable Metrics/ParameterLists
83 84 85 |
# File 'lib/ast/merge/source_render/fragment.rb', line 83 def kind :conflict end |