Class: Hash

Inherits:
Object show all
Defined in:
lib/emissary/core_ext/blank.rb,
lib/emissary/core_ext/symbolize.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#symbolizeObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/emissary/core_ext/symbolize.rb', line 19

def symbolize
  inject({}) do |hash,(key,value)|
    hash[(key.to_sym rescue key) || key] = case value
      when Hash, Array
        value.symbolize
      else
        value
    end
    hash
  end
end

#symbolize!Object



30
31
32
# File 'lib/emissary/core_ext/symbolize.rb', line 30

def symbolize!
  self.replace(self.symbolize)
end