Class: Toml::Merge::ConflictResolver

Inherits:
Ast::Merge::ConflictResolverBase
  • Object
show all
Defined in:
lib/toml/merge/conflict_resolver.rb

Overview

Resolves conflicts between template and destination TOML content using structural signatures and configurable preferences.

Examples:

Basic usage

resolver = ConflictResolver.new(template_analysis, dest_analysis)
resolver.resolve(result)

Instance Method Summary collapse

Constructor Details

#initialize(template_analysis, dest_analysis, preference: :destination, add_template_only_nodes: false, match_refiner: nil) ⇒ ConflictResolver

Creates a new ConflictResolver

Parameters:

  • template_analysis (FileAnalysis)

    Analyzed template file

  • dest_analysis (FileAnalysis)

    Analyzed destination file

  • preference (Symbol) (defaults to: :destination)

    Which version to prefer when nodes have matching signatures:

    • :destination (default) - Keep destination version (customizations)

    • :template - Use template version (updates)

  • add_template_only_nodes (Boolean) (defaults to: false)

    Whether to add nodes only in template

  • match_refiner (#call, nil) (defaults to: nil)

    Optional match refiner for fuzzy matching



22
23
24
25
26
27
28
29
30
31
# File 'lib/toml/merge/conflict_resolver.rb', line 22

def initialize(template_analysis, dest_analysis, preference: :destination, add_template_only_nodes: false, match_refiner: nil)
  super(
    strategy: :batch,
    preference: preference,
    template_analysis: template_analysis,
    dest_analysis: dest_analysis,
    add_template_only_nodes: add_template_only_nodes
  )
  @match_refiner = match_refiner
end