Sha256: 7457ff51d2e1d56541f0b28158a2597d39b0e861c31efe0e8ada900504cb7dfb

Contents?: true

Size: 360 Bytes

Versions: 12

Compression:

Stored size: 360 Bytes

Contents

module Lurker
  module Utils
    module_function

    def stringify_keys(object)
      case object
      when Hash
        object.each_with_object({}) do |(key, value), memo|
          memo[key.to_s] = stringify_keys(value)
        end
      when Array
        object.map { |value| stringify_keys(value) }
      else
        object
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
lurker-1.0.0 lib/lurker/utils.rb
lurker-0.6.12 lib/lurker/utils.rb
lurker-0.6.11 lib/lurker/utils.rb
lurker-0.6.10 lib/lurker/utils.rb
lurker-0.6.9 lib/lurker/utils.rb
lurker-0.6.8 lib/lurker/utils.rb
lurker-0.6.7 lib/lurker/utils.rb
lurker-0.6.6 lib/lurker/utils.rb
lurker-0.6.5 lib/lurker/utils.rb
lurker-0.6.4 lib/lurker/utils.rb
lurker-0.6.3 lib/lurker/utils.rb
lurker-0.6.2 lib/lurker/utils.rb