Class: WhiskeyDisk::Config::CheckForDuplicateDomainsFilter

Inherits:
AbstractFilter
  • Object
show all
Defined in:
lib/whiskey_disk/config/filters/check_for_duplicate_domains_filter.rb

Instance Attribute Summary

Attributes inherited from AbstractFilter

#config

Instance Method Summary collapse

Methods inherited from AbstractFilter

#environment_name, #initialize, #project_name

Constructor Details

This class inherits a constructor from WhiskeyDisk::Config::AbstractFilter

Instance Method Details

#check_domains(domain_list) ⇒ Object


6
7
8
9
10
11
12
# File 'lib/whiskey_disk/config/filters/check_for_duplicate_domains_filter.rb', line 6

def check_domains(domain_list)
  seen = {}
  domain_list.each do |domain|
    raise "duplicate domain [#{domain['name']}] in configuration file for project [#{environment_name}], target [#{environment_name}]" if seen[domain['name']]
    seen[domain['name']] = true
  end
end

#filter(data) ⇒ Object


14
15
16
17
# File 'lib/whiskey_disk/config/filters/check_for_duplicate_domains_filter.rb', line 14

def filter(data)
  check_domains(data['domain'])
  data
end