Class: Prism::Merge::PartialTemplateMerger

Inherits:
Ast::Merge::PartialTemplateMergerBase
  • Object
show all
Defined in:
lib/prism/merge/partial_template_merger.rb

Overview

Merges a partial Ruby template into a specific top-level structural section of a destination document.

This implementation uses the shared navigable partial-template substrate in ast-merge and keeps Ruby-specific behavior local: top-level Prism statement adaptation, section-boundary selection, and SmartMerger wiring.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template:, destination:, anchor:, boundary: nil, preference: :template, add_missing: true, when_missing: :skip, replace_mode: false, signature_generator: nil, node_typing: nil, match_refiner: nil, corruption_handling: :heal) ⇒ PartialTemplateMerger

Returns a new instance of PartialTemplateMerger.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/prism/merge/partial_template_merger.rb', line 14

def initialize(
  template:,
  destination:,
  anchor:,
  boundary: nil,
  preference: :template,
  add_missing: true,
  when_missing: :skip,
  replace_mode: false,
  signature_generator: nil,
  node_typing: nil,
  match_refiner: nil,
  corruption_handling: :heal
)
  @corruption_handling = corruption_handling

  super(
    template: template,
    destination: destination,
    anchor: anchor,
    boundary: boundary,
    preference: preference,
    add_missing: add_missing,
    when_missing: when_missing,
    replace_mode: replace_mode,
    signature_generator: signature_generator,
    node_typing: node_typing,
    match_refiner: match_refiner,
  )
end

Instance Attribute Details

#corruption_handlingObject (readonly)

Returns the value of attribute corruption_handling.



12
13
14
# File 'lib/prism/merge/partial_template_merger.rb', line 12

def corruption_handling
  @corruption_handling
end