Class: WhiskeyDisk::Config::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/whiskey_disk/config/filter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Filter

Returns a new instance of Filter.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/whiskey_disk/config/filter.rb', line 21

def initialize(config)
  @config = config
  @filters = [
    StringifyHashKeysFilter,
    EnvironmentScopeFilter,
    ProjectScopeFilter,
    SelectProjectAndEnvironmentFilter,
    AddEnvironmentNameFilter,
    AddProjectNameFilter,
    DefaultConfigTargetFilter,
    DefaultDomainFilter,
    HashifyDomainEntriesFilter,
    LocalizeDomainsFilter,
    CheckForDuplicateDomainsFilter,
    ConvertRoleStringsToListFilter,
    DropEmptyDomainRolesFilter,
    NormalizeSshOptionsFilter
  ]
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



19
20
21
# File 'lib/whiskey_disk/config/filter.rb', line 19

def config
  @config
end

#filtersObject (readonly)

Returns the value of attribute filters.



19
20
21
# File 'lib/whiskey_disk/config/filter.rb', line 19

def filters
  @filters
end

Instance Method Details

#filter_data(data) ⇒ Object



41
42
43
44
45
# File 'lib/whiskey_disk/config/filter.rb', line 41

def filter_data(data)
  filters.inject(data.clone) do |result, filter|
    result = filter.new(config).filter(result)
  end
end