Class: WhiskeyDisk::Config::LocalizeDomainsFilter

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

#filter(data) ⇒ Object



18
19
20
# File 'lib/whiskey_disk/config/filters/localize_domains_filter.rb', line 18

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

#is_local?(name) ⇒ Boolean

Returns:

  • (Boolean)


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

def is_local?(name)
  name.nil? or name == ''
end

#localize(name) ⇒ Object



10
11
12
# File 'lib/whiskey_disk/config/filters/localize_domains_filter.rb', line 10

def localize(name)
  is_local?(name) ? 'local' : name
end

#localize_domains(domain_list) ⇒ Object



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

def localize_domains(domain_list)
  domain_list.collect {|domain| domain.merge('name' => localize(domain['name'])) }
end