Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/infostrada/core_ext/hash.rb

Instance Method Summary collapse

Instance Method Details

#symbolize_keysObject



2
3
4
# File 'lib/infostrada/core_ext/hash.rb', line 2

def symbolize_keys
  transform_keys{ |key| key.to_sym rescue key }
end

#transform_keysObject



6
7
8
9
10
11
12
13
# File 'lib/infostrada/core_ext/hash.rb', line 6

def transform_keys
  return enum_for(:transform_keys) unless block_given?
  result = self.class.new
  each_key do |key|
    result[yield(key)] = self[key]
  end
  result
end