Sha256: 850669cf9789adfb64414191319c4890e04bf626baf134845ddc7ce9ba7f0a3f

Contents?: true

Size: 468 Bytes

Versions: 7

Compression:

Stored size: 468 Bytes

Contents

# frozen_string_literal: true

module Micro
  module Attributes
    module AttributesUtils
      ARGUMENT_ERROR_MSG = 'argument must be a Hash'.freeze

      def self.hash_argument!(arg)
        return arg if arg.is_a?(Hash)

        raise ArgumentError, ARGUMENT_ERROR_MSG
      end

      def self.stringify_hash_keys!(arg)
        hash_argument!(arg).each_with_object({}) do |(key, val), memo|
          memo[key.to_s] = val
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
u-attributes-1.2.0 lib/micro/attributes/attributes_utils.rb
u-attributes-1.1.1 lib/micro/attributes/attributes_utils.rb
u-attributes-1.1.0 lib/micro/attributes/attributes_utils.rb
u-attributes-1.0.1 lib/micro/attributes/attributes_utils.rb
u-attributes-1.0.0 lib/micro/attributes/attributes_utils.rb
u-attributes-0.14.0 lib/micro/attributes/attributes_utils.rb
u-attributes-0.13.0 lib/micro/attributes/attributes_utils.rb