Class: WhiskeyDisk::Config::StringifyHashKeysFilter

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



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

def filter(data)
  stringify(data)
end

#stringify(structure) ⇒ Object



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

def stringify(structure)
  return structure.clone unless structure.respond_to? :keys
  stringify_hash(structure)
end

#stringify_hash(data) ⇒ Object



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

def stringify_hash(data)
  result = {}
  data.each_pair do |key, value|
    result[key.to_s] = stringify(value)
  end
  result
end