Skip to content

Commit 31d07a3

Browse files
committed
Stub the single item array method
1 parent 38b847c commit 31d07a3

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

lib/octocatalog-diff/catalog-diff/filter.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
require_relative 'filter/absent_file'
33
require_relative 'filter/compilation_dir'
44
require_relative 'filter/json'
5+
require_relative 'filter/single_item_array'
56
require_relative 'filter/yaml'
67

78
require 'stringio'
@@ -13,7 +14,7 @@ class Filter
1314
attr_accessor :logger
1415

1516
# List the available filters here (by class name) for use in the validator method.
16-
AVAILABLE_FILTERS = %w(AbsentFile CompilationDir JSON YAML).freeze
17+
AVAILABLE_FILTERS = %w(AbsentFile CompilationDir JSON SingleItemArray YAML).freeze
1718

1819
# Public: Determine whether a particular filter exists. This can be used to validate
1920
# a user-submitted filter.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# frozen_string_literal: true
2+
3+
require_relative '../filter'
4+
5+
require 'set'
6+
7+
module OctocatalogDiff
8+
module CatalogDiff
9+
class Filter
10+
# Filter out changes in parameters when one catalog has a parameter that's a string and
11+
# the other catalog has that same parameter as an array containing the same string.
12+
# For example, under this filter, the following is not a change:
13+
# catalog1: notify => "Service[foo]"
14+
# catalog2: notify => ["Service[foo]"]
15+
class SingleItemArray < OctocatalogDiff::CatalogDiff::Filter
16+
# Public: Implement the filter for single-item arrays whose item exactly matches the
17+
# item that's not in an array in the other catalog.
18+
#
19+
# @param diff [OctocatalogDiff::API::V1::Diff] Difference
20+
# @param _options [Hash] Additional options (there are none for this filter)
21+
# @return [Boolean] true if this difference is a YAML file with identical objects, false otherwise
22+
def filtered?(_diff, _options = {})
23+
false
24+
end
25+
end
26+
end
27+
end
28+
end

0 commit comments

Comments
 (0)