Class: WhiskeyDisk::Config::HashifyDomainEntriesFilter
- Inherits:
-
AbstractFilter
show all
- Defined in:
- lib/whiskey_disk/config/filters/hashify_domain_entries_filter.rb
Instance Attribute Summary
#config
Instance Method Summary
collapse
#environment_name, #initialize, #project_name
Instance Method Details
#filter(data) ⇒ Object
23
24
25
|
# File 'lib/whiskey_disk/config/filters/hashify_domain_entries_filter.rb', line 23
def filter(data)
data.merge('domain' => hashify_domains(data['domain']))
end
|
#hashify_domain(domain) ⇒ Object
10
11
12
|
# File 'lib/whiskey_disk/config/filters/hashify_domain_entries_filter.rb', line 10
def hashify_domain(domain)
needs_hashing?(domain) ? { 'name' => domain } : domain
end
|
#hashify_domains(domain_list) ⇒ Object
18
19
20
21
|
# File 'lib/whiskey_disk/config/filters/hashify_domain_entries_filter.rb', line 18
def hashify_domains(domain_list)
return new_domain unless domain_list
[ domain_list ].flatten.collect {|domain| hashify_domain(domain) }
end
|
#needs_hashing?(domain) ⇒ Boolean
6
7
8
|
# File 'lib/whiskey_disk/config/filters/hashify_domain_entries_filter.rb', line 6
def needs_hashing?(domain)
! domain.respond_to?(:keys)
end
|
#new_domain ⇒ Object
14
15
16
|
# File 'lib/whiskey_disk/config/filters/hashify_domain_entries_filter.rb', line 14
def new_domain
{ 'name' => '' }
end
|