Class: Sq::Refinement::UsedGlob
- Inherits:
-
Object
- Object
- Sq::Refinement::UsedGlob
- Defined in:
- lib/sq/refinement/used_path.rb
Overview
Represents a glob that some target depends upon.
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(glob:, inclusion_reason:) ⇒ UsedGlob
constructor
A new instance of UsedGlob.
Constructor Details
#initialize(glob:, inclusion_reason:) ⇒ UsedGlob
Returns a new instance of UsedGlob.
115 116 117 118 |
# File 'lib/sq/refinement/used_path.rb', line 115 def initialize(glob:, inclusion_reason:) @glob = glob @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.
121 122 123 |
# File 'lib/sq/refinement/used_path.rb', line 121 def find_in_changeset(changeset) add_reason changeset.find_modification_for_glob(absolute_glob: glob), changeset: end |
#find_in_changesets(changesets) ⇒ Nil, String
Returns If the path has been modified, a string explaining the modification.
126 127 128 129 130 131 132 |
# File 'lib/sq/refinement/used_path.rb', line 126 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 |