Class: Sq::Refinement::UsedPath
- Inherits:
-
Object
- Object
- Sq::Refinement::UsedPath
- Defined in:
- lib/sq/refinement/used_path.rb
Overview
Represents a path that some target depends upon.
Direct Known Subclasses
Defined Under Namespace
Classes: YAML
Instance Method Summary collapse
-
#find_in_changeset(changeset) ⇒ Nil, String
If the path has been modified, a string explaining the modification.
-
#find_in_changesets(changesets) ⇒ Nil, String
If the path has been modified, a string explaining the modification.
-
#initialize(path:, inclusion_reason:) ⇒ UsedPath
constructor
A new instance of UsedPath.
Constructor Details
#initialize(path:, inclusion_reason:) ⇒ UsedPath
Returns a new instance of UsedPath.
15 16 17 18 |
# File 'lib/sq/refinement/used_path.rb', line 15 def initialize(path:, inclusion_reason:) @path = path @inclusion_reason = inclusion_reason end |
Instance Method Details
#find_in_changeset(changeset) ⇒ Nil, String
Returns If the path has been modified, a string explaining the modification.
22 23 24 |
# File 'lib/sq/refinement/used_path.rb', line 22 def find_in_changeset(changeset) add_reason changeset.find_modification_for_path(absolute_path: path), changeset: end |
#find_in_changesets(changesets) ⇒ Nil, String
Returns If the path has been modified, a string explaining the modification.
28 29 30 31 32 33 34 |
# File 'lib/sq/refinement/used_path.rb', line 28 def find_in_changesets(changesets) raise ArgumentError, 'Must provide at least one changeset' if changesets.empty? changesets.reduce(true) do |explanation, changeset| explanation && find_in_changeset(changeset) end end |