Sha256: c566c67fe6e87d34ca4b11ec8a20f371d839dc02285c7e2c9e30aed1bcbb4ac9

Contents?: true

Size: 380 Bytes

Versions: 6

Compression:

Stored size: 380 Bytes

Contents

module Chargify2
  module Utils
    module HashExtensions
      # Symbolizes keys for flat or nested hashes (operates recursively on nested hashes)
      def symbolize_keys
        Hash[
          self.map { |key, value|
            k = key.to_sym
            v = value.is_a?(Hash) ? value.symbolize_keys : value
            [k,v]
          }
        ]
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
chargify2-0.2.5 lib/chargify2/utils.rb
chargify2-0.2.4 lib/chargify2/utils.rb
chargify2-0.2.2 lib/chargify2/utils.rb
chargify2-0.2.1 lib/chargify2/utils.rb
chargify2-0.2.0 lib/chargify2/utils.rb
chargify2-0.1.0 lib/chargify2/utils.rb