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

Constructor Details

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

Returns a new instance of YAML.



49
50
51
52
# File 'lib/refinement/used_path.rb', line 49

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



55
56
57
58
# File 'lib/refinement/used_path.rb', line 55

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