Skip to content

Instantly share code, notes, and snippets.

@jeffutter
Created June 25, 2012 05:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffutter/3b7d3d3b77b9c9ec685e to your computer and use it in GitHub Desktop.
Save jeffutter/3b7d3d3b77b9c9ec685e to your computer and use it in GitHub Desktop.
foo
def update(key, val)
*keys,to_set=key.split('.')
klass = keys.inject(Settings.get('instance'),:[])[to_set].class
if klass == Hash and val.class == Hash
keys.inject(Settings.get('instance'),:[])[to_set].update(val)
elsif klass == String and val.class == String
keys.inject(Settings.get('instance'),:[])[to_set]=val
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment