Sha256: e7aceb070eb6b944d47ae38afe23ad2317390f0c5054176c2986938e3e09bc18

Contents?: true

Size: 597 Bytes

Versions: 17

Compression:

Stored size: 597 Bytes

Contents

# encoding: utf-8
# This file is distributed under Ting Yun's license terms.

module TingYun
  module Support
    module HashExtensions
      module_function

      # recurses through hashes and arrays and stringifies keys
      def stringify_keys_in_object(object)
        case object
          when Hash
            object.inject({}) do |memo, (k, v)|
              memo[k.to_s] = stringify_keys_in_object(v)
              memo
            end
          when Array
            object.map {|o| stringify_keys_in_object(o)}
          else
            object
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
tingyun_rpm-3.2.0 lib/ting_yun/support/hash_extensions.rb
tingyun_rpm-1.6.1 lib/ting_yun/support/hash_extensions.rb
tingyun_rpm-1.5.0 lib/ting_yun/support/hash_extensions.rb
tingyun_rpm-1.4.2 lib/ting_yun/support/hash_extensions.rb
tingyun_rpm-1.4.1 lib/ting_yun/support/hash_extensions.rb
tingyun_rpm-1.3.1 lib/ting_yun/support/hash_extensions.rb
tingyun_rpm-1.3.0 lib/ting_yun/support/hash_extensions.rb
tingyun_rpm-1.2.0 lib/ting_yun/support/hash_extensions.rb
tingyun_rpm-1.1.4.2 lib/ting_yun/support/hash_extensions.rb
tingyun_rpm-1.1.4.1 lib/ting_yun/support/hash_extensions.rb
tingyun_rpm-1.1.4 lib/ting_yun/support/hash_extensions.rb
tingyun_rpm-1.1.3 lib/ting_yun/support/hash_extensions.rb
tingyun_rpm-1.1.2 lib/ting_yun/support/hash_extensions.rb
tingyun_rpm-1.1.1 lib/ting_yun/support/hash_extensions.rb
tingyun_rpm-1.1.0 lib/ting_yun/support/hash_extensions.rb
tingyun_rpm-1.0.7 lib/ting_yun/support/hash_extensions.rb
tingyun_rpm-1.0.6 lib/ting_yun/support/hash_extensions.rb