Class: WhiskeyDisk::Config::ConvertRoleStringsToListFilter

Inherits:
AbstractFilter
  • Object
show all
Defined in:
lib/whiskey_disk/config/filters/convert_role_strings_to_list_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

#convert_all_roles(domains_list) ⇒ Object



11
12
13
# File 'lib/whiskey_disk/config/filters/convert_role_strings_to_list_filter.rb', line 11

def convert_all_roles(domains_list)
  domains_list.collect {|domain| convert_roles_for_domain(domain) }
end

#convert_roles_for_domain(domain) ⇒ Object



6
7
8
9
# File 'lib/whiskey_disk/config/filters/convert_role_strings_to_list_filter.rb', line 6

def convert_roles_for_domain(domain)
  return domain unless domain['roles']
  domain.merge('roles' => [ domain['roles'] ].flatten)
end

#filter(data) ⇒ Object



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

def filter(data)
  data.merge('domain' => convert_all_roles(data['domain']))
end