Class: Object

Inherits:
BasicObject
Defined in:
lib/capistrano/chocopoche/mysql.rb

Overview

Converts deeply keys of a hash|array into symbols when they are strings

Instance Method Summary collapse

Instance Method Details

#deep_symbolize_keysObject



8
9
10
11
12
# File 'lib/capistrano/chocopoche/mysql.rb', line 8

def deep_symbolize_keys
  return self.inject({}){|memo,(k,v)| memo[k.to_sym] = v.deep_symbolize_keys; memo} if self.is_a? Hash
  return self.inject([]){|memo,v    | memo           << v.deep_symbolize_keys; memo} if self.is_a? Array
  return self
end