Module: HashExtensions

Defined in:
lib/post_remote_log/extensions.rb

Overview

Copyright © 2010 Samuel Williams. Released under the GNU GPLv3.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <www.gnu.org/licenses/>.

Instance Method Summary collapse

Instance Method Details

#symbolize_keysObject



18
19
20
21
22
23
24
25
# File 'lib/post_remote_log/extensions.rb', line 18

def symbolize_keys
  inject({}) do |acc, (k,v)|
    key = String === k ? k.to_sym : k
    value = Hash === v ? v.symbolize_keys : v
    acc[key] = value
    acc
  end
end