Sha256: 17213364c6dbc40d741213a8b70ce83942d5f2f985581329ecb828bcef52fcfd

Contents?: true

Size: 422 Bytes

Versions: 6

Compression:

Stored size: 422 Bytes

Contents

# frozen_string_literal: true

module Micro
  class Case
    module Utils
      def self.symbolize_hash_keys(hash)
        if Kind::Of::Hash(hash).respond_to?(:transform_keys)
          hash.transform_keys { |key| key.to_sym rescue key }
        else
          hash.each_with_object({}) do |(k, v), memo|
            key = k.to_sym rescue k

            memo[key] = v
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
u-case-3.0.0.rc4 lib/micro/case/utils.rb
u-case-3.0.0.rc3 lib/micro/case/utils.rb
u-case-3.0.0.rc2 lib/micro/case/utils.rb
u-case-3.0.0.rc1 lib/micro/case/utils.rb
u-case-2.6.0 lib/micro/case/utils.rb
u-case-2.5.0 lib/micro/case/utils.rb