Class: Ast::Merge::Text::ConflictResolver
- Inherits:
-
ConflictResolverBase
- Object
- ConflictResolverBase
- Ast::Merge::Text::ConflictResolver
- Includes:
- Ast::Merge::TrailingGroups::DestIterate
- Defined in:
- lib/ast/merge/text/conflict_resolver.rb
Overview
Conflict resolver for text-based AST merging.
Uses content-based matching with destination-order preservation:
- Lines are matched by normalized content (whitespace-trimmed)
- Destination order is preserved (destination is source of truth for structure)
- Template-only lines are optionally inserted in template order relative to their matched anchors
- Freeze blocks are always preserved from destination
Constant Summary
Constants inherited from ConflictResolverBase
ConflictResolverBase::DECISION_ADDED, ConflictResolverBase::DECISION_APPENDED, ConflictResolverBase::DECISION_DESTINATION, ConflictResolverBase::DECISION_FREEZE_BLOCK, ConflictResolverBase::DECISION_FROZEN, ConflictResolverBase::DECISION_IDENTICAL, ConflictResolverBase::DECISION_KEPT_DEST, ConflictResolverBase::DECISION_KEPT_TEMPLATE, ConflictResolverBase::DECISION_RECURSIVE, ConflictResolverBase::DECISION_REPLACED, ConflictResolverBase::DECISION_TEMPLATE
Instance Attribute Summary
Attributes inherited from ConflictResolverBase
#add_template_only_nodes, #dest_analysis, #match_refiner, #preference, #recursive, #remove_template_missing_nodes, #strategy, #template_analysis
Instance Method Summary collapse
-
#initialize(template_analysis, dest_analysis, preference: :destination, add_template_only_nodes: false, resolution_mode: :eager, unresolved_policy: nil) ⇒ ConflictResolver
constructor
Initialize the conflict resolver.
Methods included from Ast::Merge::TrailingGroups::DestIterate
#build_dest_iterate_trailing_groups, #emit_prefix_trailing_group
Methods included from Ast::Merge::TrailingGroups::Core
#build_trailing_groups, #emit_remaining_trailing_groups, #flush_ready_trailing_groups
Methods inherited from ConflictResolverBase
#default_preference, #freeze_node?, #per_type_preference?, #preference_for_node, #resolve
Constructor Details
#initialize(template_analysis, dest_analysis, preference: :destination, add_template_only_nodes: false, resolution_mode: :eager, unresolved_policy: nil) ⇒ ConflictResolver
Initialize the conflict resolver
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ast/merge/text/conflict_resolver.rb', line 28 def initialize( template_analysis, dest_analysis, preference: :destination, add_template_only_nodes: false, resolution_mode: :eager, unresolved_policy: nil ) super( strategy: :batch, preference: preference, template_analysis: template_analysis, dest_analysis: dest_analysis, add_template_only_nodes: add_template_only_nodes ) @resolution_mode = resolution_mode @unresolved_policy = Ast::Merge::UnresolvedPolicy.coerce(unresolved_policy) end |