Class: Canon::Rebaseliner::HeredocLocator
- Inherits:
-
Object
- Object
- Canon::Rebaseliner::HeredocLocator
- Defined in:
- lib/canon/rebaseliner/heredoc_locator.rb
Overview
Resolve a Prism AST node (the expected argument passed to a Canon
matcher) to a HeredocTarget that can be rewritten in-place, or to a
skip reason. Handles the metanorma-iso pattern of multiple sequential
assignments to the same local var via "most-recent assignment before
the matcher line" semantics.
Defined Under Namespace
Classes: Result
Instance Method Summary collapse
-
#initialize(spec_path:, source:, enclosing_block:, expected_node:, matcher_line:) ⇒ HeredocLocator
constructor
A new instance of HeredocLocator.
-
#resolve ⇒ Result
:ok with a HeredocTarget, or a :skipped_* status.
Constructor Details
#initialize(spec_path:, source:, enclosing_block:, expected_node:, matcher_line:) ⇒ HeredocLocator
Returns a new instance of HeredocLocator.
29 30 31 32 33 34 35 36 |
# File 'lib/canon/rebaseliner/heredoc_locator.rb', line 29 def initialize(spec_path:, source:, enclosing_block:, expected_node:, matcher_line:) @spec_path = spec_path @source = source @enclosing_block = enclosing_block @expected_node = expected_node @matcher_line = matcher_line end |
Instance Method Details
#resolve ⇒ Result
Returns :ok with a HeredocTarget, or a :skipped_* status.
39 40 41 |
# File 'lib/canon/rebaseliner/heredoc_locator.rb', line 39 def resolve resolve_node(@expected_node) end |