Class: Hash

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

Overview

A simple extension to Hash to add symbolification of hash keys.

Note: Since this gem doesn’t require Rails, we cannot rely on those

constructs.  We could use the Hashie gem, but that seems like
a lot of overhead for a such a simple operation.  Additionally
I've seen conflicts with Hashie versions (e.g. Rocketpants only
works with Hashie < 3 and those versions of Hashie don't contain
the needed symbolize_keys method).

Instance Method Summary collapse

Instance Method Details

#symbolize_hash_keysObject

Recursively (through Hash and Array) converts all Hash keys to symbols (calling to_sym) and returns a duplicate hash.



14
15
16
# File 'lib/dmtd_vbmapp_data/hash.rb', line 14

def symbolize_hash_keys
  Hash.sym_hash_keys(self)
end