Sha256: db03b4603b2e50ec8d6ac351ecac33cbb3df5afb12a34123ea4b341ba5ba8133

Contents?: true

Size: 461 Bytes

Versions: 4

Compression:

Stored size: 461 Bytes

Contents

# frozen_string_literal: true

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

      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

4 entries across 4 versions & 1 rubygems

Version Path
u-attributes-0.12.0 lib/micro/attributes/attributes_utils.rb
u-attributes-0.11.0 lib/micro/attributes/attributes_utils.rb
u-attributes-0.10.0 lib/micro/attributes/attributes_utils.rb
u-attributes-0.9.0 lib/micro/attributes/attributes_utils.rb