Class: Toml::Merge::SmartMerger
- Inherits:
-
Ast::Merge::SmartMergerBase
- Object
- Ast::Merge::SmartMergerBase
- Toml::Merge::SmartMerger
- Defined in:
- lib/toml/merge/smart_merger.rb
Overview
High-level merger for TOML content.
Orchestrates parsing, analysis, and conflict resolution.
Extends SmartMergerBase with backend-agnostic parsing via tree_haver.
Supports both tree-sitter and Citrus/toml-rb backends (auto-selected by TreeHaver).
Instance Attribute Summary collapse
-
#backend ⇒ Symbol
readonly
The AST format being used (:tree_sitter or :citrus).
Instance Method Summary collapse
-
#initialize(template_content, dest_content, signature_generator: nil, preference: :destination, add_template_only_nodes: false, freeze_token: nil, match_refiner: nil, regions: nil, region_placeholder: nil, node_typing: nil, **options) ⇒ SmartMerger
constructor
Creates a new SmartMerger.
-
#options ⇒ Hash
Backward-compatible options hash.
Constructor Details
#initialize(template_content, dest_content, signature_generator: nil, preference: :destination, add_template_only_nodes: false, freeze_token: nil, match_refiner: nil, regions: nil, region_placeholder: nil, node_typing: nil, **options) ⇒ SmartMerger
Note:
To force a specific backend, use TreeHaver.with_backend or TREE_HAVER_BACKEND env var.
TreeHaver handles backend selection, auto-detection, and fallback.
Creates a new SmartMerger
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/toml/merge/smart_merger.rb', line 60 def initialize( template_content, dest_content, signature_generator: nil, preference: :destination, add_template_only_nodes: false, freeze_token: nil, match_refiner: nil, regions: nil, region_placeholder: nil, node_typing: nil, ** ) super( template_content, dest_content, signature_generator: signature_generator, preference: preference, add_template_only_nodes: add_template_only_nodes, freeze_token: freeze_token, match_refiner: match_refiner, regions: regions, region_placeholder: region_placeholder, node_typing: node_typing, ** ) # Capture the resolved backend from template analysis (for NodeTypeNormalizer) @backend = @template_analysis.backend end |
Instance Attribute Details
#backend ⇒ Symbol (readonly)
Returns The AST format being used (:tree_sitter or :citrus).
41 42 43 |
# File 'lib/toml/merge/smart_merger.rb', line 41 def backend @backend end |
Instance Method Details
#options ⇒ Hash
Backward-compatible options hash
94 95 96 97 98 99 100 |
# File 'lib/toml/merge/smart_merger.rb', line 94 def { preference: @preference, add_template_only_nodes: @add_template_only_nodes, match_refiner: @match_refiner, } end |