Class: Refinement::UsedPath::YAML

Inherits:
Refinement::UsedPath show all
Defined in:
lib/refinement/used_path.rb

Overview

Represents a path to a YAML file that some target depends upon, but where only a subset of the YAML is needed to determine a change.

Instance Method Summary collapse

Methods inherited from Refinement::UsedPath

#find_in_changesets

Constructor Details

#initialize(yaml_keypath:, **kwargs) ⇒ YAML

Returns a new instance of YAML.



71
72
73
74
# File 'lib/refinement/used_path.rb', line 71

def initialize(yaml_keypath:, **kwargs)
  super(**kwargs)
  @yaml_keypath = yaml_keypath
end

Instance Method Details

#find_in_changeset(changeset) ⇒ Nil, String

Returns If the path has been modified, a string explaining the modification.

Parameters:

  • changeset (Changeset)

    the changeset to search for a modification to this path

Returns:

  • (Nil, String)

    If the path has been modified, a string explaining the modification



77
78
79
80
# File 'lib/refinement/used_path.rb', line 77

def find_in_changeset(changeset)
  modification, _yaml_diff = changeset.find_modification_for_yaml_keypath(absolute_path: path, keypath: yaml_keypath)
  add_reason modification, changeset: changeset
end