Method: Hash#symbolize_keys

Defined in:
lib/fancybox2/core_ext/hash.rb

#symbolize_keysObject Also known as: to_options

Returns a new hash with all keys converted to symbols, as long as they respond to to_sym.

hash = { 'name' => 'Rob', 'age' => '28' }

hash.symbolize_keys
# => {:name=>"Rob", :age=>"28"}


72
73
74
# File 'lib/fancybox2/core_ext/hash.rb', line 72

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