Method: Hash#my_stringify_keys

Defined in:
lib/arachni/ruby/hash.rb

#my_stringify_keys(recursively = true) ⇒ Hash

Converts the hash keys to strings.

Parameters:

  • recursively (Boolean) (defaults to: true)

    Go through the Hash recursively?

Returns:

  • (Hash)

    Hash with self‘s keys recursively converted to strings.



22
23
24
25
26
27
28
29
# File 'lib/arachni/ruby/hash.rb', line 22

def my_stringify_keys( recursively = true )
    stringified = {}
    each do |k, v|
        stringified[k.to_s] = (recursively && v.is_a?( Hash ) ?
            v.my_stringify_keys : v)
    end
    stringified
end