Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/pione/test-helper/extension.rb

Overview

Hash extension.

Instance Method Summary collapse

Instance Method Details

#symbolize_keysObject

Symbolizes hash's keys recuirsively. This is convinient for YAML handling.



4
5
6
7
8
# File 'lib/pione/test-helper/extension.rb', line 4

def symbolize_keys
  each_with_object({}) do |(key, val), hash|
    hash[key.to_sym] = (val.kind_of?(Hash) ? val.symbolize_keys : val)
  end
end