Class: Prism::Merge::FileAligner
- Inherits:
-
Object
- Object
- Prism::Merge::FileAligner
- Defined in:
- lib/prism/merge/file_aligner.rb
Overview
Identifies sequential “anchor sections” where template and destination have identical or equivalent lines, defining merge boundaries. Similar to diff algorithm but AST-aware.
Defined Under Namespace
Instance Attribute Summary collapse
-
#anchors ⇒ Object
readonly
Returns the value of attribute anchors.
-
#boundaries ⇒ Object
readonly
Returns the value of attribute boundaries.
-
#dest_analysis ⇒ Object
readonly
Returns the value of attribute dest_analysis.
-
#template_analysis ⇒ Object
readonly
Returns the value of attribute template_analysis.
Instance Method Summary collapse
-
#align ⇒ Array<Boundary>
Perform alignment and identify anchors and boundaries.
-
#initialize(template_analysis, dest_analysis) ⇒ FileAligner
constructor
A new instance of FileAligner.
Constructor Details
#initialize(template_analysis, dest_analysis) ⇒ FileAligner
Returns a new instance of FileAligner.
48 49 50 51 52 53 |
# File 'lib/prism/merge/file_aligner.rb', line 48 def initialize(template_analysis, dest_analysis) @template_analysis = template_analysis @dest_analysis = dest_analysis @anchors = [] @boundaries = [] end |
Instance Attribute Details
#anchors ⇒ Object (readonly)
Returns the value of attribute anchors.
44 45 46 |
# File 'lib/prism/merge/file_aligner.rb', line 44 def anchors @anchors end |
#boundaries ⇒ Object (readonly)
Returns the value of attribute boundaries.
44 45 46 |
# File 'lib/prism/merge/file_aligner.rb', line 44 def boundaries @boundaries end |
#dest_analysis ⇒ Object (readonly)
Returns the value of attribute dest_analysis.
44 45 46 |
# File 'lib/prism/merge/file_aligner.rb', line 44 def dest_analysis @dest_analysis end |
#template_analysis ⇒ Object (readonly)
Returns the value of attribute template_analysis.
44 45 46 |
# File 'lib/prism/merge/file_aligner.rb', line 44 def template_analysis @template_analysis end |
Instance Method Details
#align ⇒ Array<Boundary>
Perform alignment and identify anchors and boundaries
57 58 59 60 61 |
# File 'lib/prism/merge/file_aligner.rb', line 57 def align find_anchors compute_boundaries @boundaries end |