Sha256: 870b8749c080768de14ce48bb764149b82252664853bfc129ea640b5d6aa747b

Contents?: true

Size: 523 Bytes

Versions: 3

Compression:

Stored size: 523 Bytes

Contents

module Chargify2
  module Utils
    module HashExtensions
      def recursive_symbolize_keys
        self.inject({}){|result, (key, value)|
          new_key = case key
                    when String then key.to_sym
                    else key
                    end
          new_value = case value
                      when Hash then value.recursive_symbolize_keys
                      else value
                      end
          result[new_key] = new_value
          result
        }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chargify2-0.2.8 lib/chargify2/utils.rb
chargify2-0.2.7 lib/chargify2/utils.rb
chargify2-0.2.6 lib/chargify2/utils.rb