Class: OctocatalogDiff::CatalogDiff::Filter::AbsentFile
- Inherits:
-
OctocatalogDiff::CatalogDiff::Filter
- Object
- OctocatalogDiff::CatalogDiff::Filter
- OctocatalogDiff::CatalogDiff::Filter::AbsentFile
- Defined in:
- lib/octocatalog-diff/catalog-diff/filter/absent_file.rb
Overview
Filter out changes in parameters when the “to” resource has ensure => absent.
Constant Summary collapse
- KEEP_ATTRIBUTES =
(Set.new %w(ensure backup force provider)).freeze
Constants inherited from OctocatalogDiff::CatalogDiff::Filter
Instance Attribute Summary
Attributes inherited from OctocatalogDiff::CatalogDiff::Filter
Instance Method Summary collapse
-
#filtered?(diff, _options = {}) ⇒ Boolean
Public: If a file has ensure => absent, there are certain parameters that don’t matter anymore.
-
#initialize(diffs, _logger = nil) ⇒ AbsentFile
constructor
Constructor: Since this filter requires knowledge of the entire array of diffs, override the inherited method to store those diffs in an instance variable.
Methods inherited from OctocatalogDiff::CatalogDiff::Filter
apply_filters, assert_that_filter_exists, filter, filter?
Constructor Details
#initialize(diffs, _logger = nil) ⇒ AbsentFile
Constructor: Since this filter requires knowledge of the entire array of diffs, override the inherited method to store those diffs in an instance variable.
18 19 20 21 |
# File 'lib/octocatalog-diff/catalog-diff/filter/absent_file.rb', line 18 def initialize(diffs, _logger = nil) @diffs = diffs @results = nil end |
Instance Method Details
#filtered?(diff, _options = {}) ⇒ Boolean
Public: If a file has ensure => absent, there are certain parameters that don’t matter anymore. Filter out any such parameters from the result array. Return true if the difference is in a resource where ‘ensure => absent` has been declared. Return false if they this is not the case.
31 32 33 34 |
# File 'lib/octocatalog-diff/catalog-diff/filter/absent_file.rb', line 31 def filtered?(diff, = {}) build_results if @results.nil? @results.include?(diff) end |