Sha256: 1ae742ebd787c58dcd7c2f0fcfe6f89bc1918dc783bd0b3d7f9e925479d1cc54

Contents?: true

Size: 403 Bytes

Versions: 5

Compression:

Stored size: 403 Bytes

Contents

# frozen_string_literal: true

module Darthjee
  module CoreExt
    module Hash
      class ToHashMapper
        def initialize(hash)
          @hash = hash
        end

        def map
          {}.tap do |new_hash|
            hash.each do |k, v|
              new_hash[k] = yield(k, v)
            end
          end
        end

        private

        attr_reader :hash
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
darthjee-core_ext-1.7.4 lib/darthjee/core_ext/hash/to_hash_mapper.rb
darthjee-core_ext-1.7.3 lib/darthjee/core_ext/hash/to_hash_mapper.rb
darthjee-core_ext-1.7.2 lib/darthjee/core_ext/hash/to_hash_mapper.rb
darthjee-core_ext-1.7.1 lib/darthjee/core_ext/hash/to_hash_mapper.rb
darthjee-core_ext-1.7.0 lib/darthjee/core_ext/hash/to_hash_mapper.rb