Method: Volt.wrap_config

Defined in:
lib/volt/config.rb

.wrap_config(hash) ⇒ Object

Wraps the config hash in an OpenStruct so it can be accessed in the same way as the server side config.



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/volt/config.rb', line 28

def wrap_config(hash)
  new_hash = {}

  hash.each_pair do |key, value|
    if value.is_a?(Hash)
      new_hash[key] = wrap_config(value)
    else
      new_hash[key] = value
    end
  end

  OpenStruct.new(new_hash)
end